browser(firefox): bypass CSP when calling functions from debugger (#1541)

This commit is contained in:
Yury Semikhatsky 2020-03-25 16:28:33 -07:00 committed by GitHub
parent b61198458c
commit 2203e9c017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -1 +1 @@
1056
1057

View File

@ -724,6 +724,22 @@ index 02f18c7f13c55a16688cee887f586ba3bf97a6fb..1f0c2a3192e35fd71b5fa26fa6822c2b
}
nsCOMPtr<nsIPrincipal> principal =
diff --git a/js/src/debugger/Object.cpp b/js/src/debugger/Object.cpp
index 347c4b0ebc09a7647247cd8bd8a234558c224ca3..956384fd96f574b76a5c2298340a88e9438d140a 100644
--- a/js/src/debugger/Object.cpp
+++ b/js/src/debugger/Object.cpp
@@ -2391,7 +2391,11 @@ Maybe<Completion> DebuggerObject::call(JSContext* cx,
invokeArgs[i].set(args2[i]);
}
+ // Disable CSP for the scope of the call.
+ const JSSecurityCallbacks* securityCallbacks = JS_GetSecurityCallbacks(cx);
+ JS_SetSecurityCallbacks(cx, nullptr);
ok = js::Call(cx, calleev, thisv, invokeArgs, &result);
+ JS_SetSecurityCallbacks(cx, securityCallbacks);
}
}
diff --git a/juggler/BrowserContextManager.js b/juggler/BrowserContextManager.js
new file mode 100644
index 0000000000000000000000000000000000000000..937c3d0bdf0bf1e402468a6eccd139f60b1db356