mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1065452 - Re-route exceptions directed at addon globals to their associated DOMWindow. r=bz
This commit is contained in:
parent
c0c7f8a06e
commit
5756b8f043
@ -468,7 +468,22 @@ SystemErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
|
|||||||
if (outer) {
|
if (outer) {
|
||||||
globalObject = static_cast<nsGlobalWindow*>(outer->GetCurrentInnerWindow());
|
globalObject = static_cast<nsGlobalWindow*>(outer->GetCurrentInnerWindow());
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
// We run addons in a separate privileged compartment, but they still expect
|
||||||
|
// to trigger the onerror handler of their associated DOMWindow.
|
||||||
|
//
|
||||||
|
// Note that the way we do this right now is sloppy. Error reporters can
|
||||||
|
// theoretically be triggered at arbitrary times (not just immediately before
|
||||||
|
// an AutoJSAPI comes off the stack), so we don't really have a way of knowing
|
||||||
|
// that the global of the current compartment is the correct global with which
|
||||||
|
// to report the error. But in practice this is probably fine for the time
|
||||||
|
// being, and will get cleaned up soon when we fix bug 981187.
|
||||||
|
if (!globalObject && JS::CurrentGlobalOrNull(cx)) {
|
||||||
|
globalObject = xpc::AddonWindowOrNull(JS::CurrentGlobalOrNull(cx));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!globalObject) {
|
||||||
globalObject = xpc::GetNativeForGlobal(xpc::PrivilegedJunkScope());
|
globalObject = xpc::GetNativeForGlobal(xpc::PrivilegedJunkScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user