Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ecmascript proposal-realms
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Taketoshi Aono(青野健利 a.k.a brn)
September 17, 2017
Programming
1
2.6k
Ecmascript proposal-realms
現在提案中のtc39/proposal-realmsについて
ToKyoto.js#1
Taketoshi Aono(青野健利 a.k.a brn)
September 17, 2017
Tweet
Share
More Decks by Taketoshi Aono(青野健利 a.k.a brn)
See All by Taketoshi Aono(青野健利 a.k.a brn)
document.write再考
brn
6
3.1k
Parsing Javascript
brn
14
9.4k
JSON & Object Tips
brn
1
540
CA 1Day Youth Bootcamp for Frontend LT
brn
0
1k
Modern TypeScript
brn
2
850
javascript - behind the scene
brn
3
790
tc39 proposals
brn
0
940
プロダクト開発とTypeScript
brn
8
3k
React-Springでリッチなアニメーション
brn
1
750
Other Decks in Programming
See All in Programming
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
650
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
2026年 エンジニアリング自己学習法
yumechi
0
130
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
170
CSC307 Lecture 04
javiergs
PRO
0
660
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
250
dchart: charts from deck markup
ajstarks
3
990
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
160
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
64
The Curse of the Amulet
leimatthew05
1
8.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
110
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
930
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
240
エンジニアに許された特別な時間の終わり
watany
106
230k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
170
Transcript
Ecmascript Proposal-Realms
せ: @brn (ꫬꅿ⨳ⵃa.k.a ـٕ٦ظ) 耵噟: ؿٗٝزؒٝسؒٝآص،٥iOSؒٝآص، ⠓爡: Cyberagent ،سذؙأةآؔRightSegment٥AI Messenger
ـؚٗ: http://abcdef.gets.b6n.ch/ Twitter: https://twitter.com/brn227 GitHub: https://github.com/brn
What is Relms? Realmsהכءٝفٕח鎉ֲהծ DOM搀׃Iframe٥Node.JSךVMٌآُ٦ٕ ְזך
What can we do? Realms⢪ֲֿהדⴽךglobalؔـآؙؑز橆㞮ד ؝٦س晙evalֿׅהָדֹկ
let realm = new Realm();! ! let outerGlobal = window;!
let innerGlobal = realm.global;! ! let f = realm.evalScript("(function() { return 17 })");! ! f() === 17 // true! ! Reflect.getPrototypeOf(f) === outerGlobal.Function.prototype // false! ! Reflect.getPrototypeOf(f) === innerGlobal.Function.prototype // true!
Hook some calls תRealmsך؝ٝأزؙٓة٦חؔـآؙؑز床ֿׅהדぐ珏 Hook㹋鄲ֿׅהָדֹկ
const r = new Realm({! evalHook(sourceText) {! return compile(sourceText);! },!
importHook(referrerNamespace, specifier) {! ...! }! });! const result = r.eval('eval("1")');! // compile('1')を呼び出して、戻り値を評価する const ns = r.eval('import("foo")');! // referrerNamespaceがnullでspecifierが"foo"!
Your own Realms Realmsכؙٓأזךד竰䪫׃ג荈ⴓ杝荈ך橆㞮欰䧭ֿׅהָד ֹկ
class FakeWindow extends Realm {! init() {! super.init();! // グローバルを初期化
let global = this.global;! ! // 各種グローバルオブジェクトを書き換え global.document = new FakeDocument(...);! global.alert = new Proxy(fakeAlert, { ... });! ...! }! }!
Limitation 植㖈ךהֿevalScriptח湫䱸؝٦س床ׁזְה꼽湡կ 㢩鿇أؙٔفزRealmsז橆㞮ד㹋遤׃ְկ https://github.com/tc39/proposal-realms/issues/71 Realms.prototype.importScript 䲿周׃גֶֹת׃կ
Status תStage-1זךד孡ꞿח䖉ְ
Summary ➬✲ָ䎢デ噟歲זךד穠圓ⴖ㹋חק׃ְկ document.writeהַ剅ֹ䳔ְִׄׯ։