Skip to content

Commit

Permalink
browser(firefox): wait for script to be evaluated in Worker (#1543)
Browse files Browse the repository at this point in the history
  • Loading branch information
aslushnikov committed Mar 26, 2020
1 parent 7e75cef commit 09cbf33
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion browser_patches/firefox/BUILD_NUMBER
@@ -1 +1 @@
1057
1058
20 changes: 17 additions & 3 deletions browser_patches/firefox/patches/bootstrap.diff
Expand Up @@ -4532,10 +4532,10 @@ index 0000000000000000000000000000000000000000..caee4df323d0a526ed7e38947c41c643
+
diff --git a/juggler/content/WorkerMain.js b/juggler/content/WorkerMain.js
new file mode 100644
index 0000000000000000000000000000000000000000..a6ed6200364b871ee21ee2cdfd2c9246c9bf0055
index 0000000000000000000000000000000000000000..fb35b515e58829d86bb74f36eecd8dc885102d69
--- /dev/null
+++ b/juggler/content/WorkerMain.js
@@ -0,0 +1,69 @@
@@ -0,0 +1,83 @@
+"use strict";
+loadSubScript('chrome://juggler/content/content/Runtime.js');
+loadSubScript('chrome://juggler/content/SimpleChannel.js');
Expand All @@ -4551,7 +4551,21 @@ index 0000000000000000000000000000000000000000..a6ed6200364b871ee21ee2cdfd2c9246
+};
+
+const runtime = new Runtime(true /* isWorker */);
+runtime.createExecutionContext(null /* domWindow */, global, {});
+
+(() => {
+ // Create execution context in the runtime only when the script
+ // source was actually evaluated in it.
+ const dbg = new Debugger(global);
+ if (dbg.findScripts({global}).length) {
+ runtime.createExecutionContext(null /* domWindow */, global, {});
+ } else {
+ dbg.onNewScript = function(s) {
+ dbg.onNewScript = undefined;
+ dbg.removeAllDebuggees();
+ runtime.createExecutionContext(null /* domWindow */, global, {});
+ };
+ }
+})();
+
+class RuntimeAgent {
+ constructor(runtime, channel, sessionId) {
Expand Down

0 comments on commit 09cbf33

Please sign in to comment.