Skip to content

Commit

Permalink
Bug 1665862: Don't use AutoSafeJSContext in XMLHttpRequestWorker. r=nika
Browse files Browse the repository at this point in the history
It crashes if it fails to create the unprivileged junk scope, which is not
great when it's being used by a fallible function.

Differential Revision: https://phabricator.services.mozilla.com/D90753
  • Loading branch information
kmaglione committed Sep 19, 2020
1 parent e1b767e commit fb03af0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dom/xhr/XMLHttpRequestWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,12 @@ Proxy::HandleEvent(Event* aEvent) {
}

{
AutoSafeJSContext cx;
AutoJSAPI jsapi;
JSObject* junkScope = xpc::UnprivilegedJunkScope(fallible);
if (!junkScope || !jsapi.Init(junkScope)) {
return NS_ERROR_FAILURE;
}
JSContext* cx = jsapi.cx();

JS::Rooted<JS::Value> value(cx);
if (!GetOrCreateDOMReflectorNoWrap(cx, mXHR, &value)) {
Expand Down

0 comments on commit fb03af0

Please sign in to comment.