Bug 1353074 - Protect __webDriverComplete global from introspection; r?maja_zf
For similar reasons given in the previous commit, we also want to protect
the window.__webDriverComplete global from accidental introspection from
web content.
MozReview-Commit-ID: FyTWHrgee15
--- a/testing/marionette/evaluate.js
+++ b/testing/marionette/evaluate.js
@@ -98,17 +98,17 @@ this.evaluate = {};
* @throws ScriptTimeoutError
* If the script was interrupted due to script timeout.
*/
evaluate.sandbox = function (sb, script, args = [], opts = {}) {
let scriptTimeoutID, timeoutHandler, unloadHandler;
let promise = new Promise((resolve, reject) => {
let src = "";
- sb[COMPLETE] = resolve;
+ sb[COMPLETE] = sandbox.cloneInto(resolve, sb);
timeoutHandler = () => reject(new ScriptTimeoutError("Timed out"));
unloadHandler = sandbox.cloneInto(
() => reject(new JavaScriptError("Document was unloaded during execution")),
sb);
// wrap in function
if (!opts.directInject) {
if (opts.async) {