mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1092156 - [e10s] Don't use compartment-per-addon if window already associated with add-on (r=bholley)
This commit is contained in:
parent
7cf195d449
commit
37ff17b630
@ -194,6 +194,7 @@
|
||||
|
||||
#include "mozilla/dom/SelectionChangeEvent.h"
|
||||
|
||||
#include "mozilla/AddonPathService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsLocation.h"
|
||||
@ -2264,6 +2265,7 @@ CreateNativeGlobalForInner(JSContext* aCx,
|
||||
top = aNewInner->GetTop();
|
||||
}
|
||||
JS::CompartmentOptions options;
|
||||
options.setAddonId(MapURIToAddonID(aURI));
|
||||
if (top) {
|
||||
if (top->GetGlobalJSObject()) {
|
||||
options.setSameZoneAs(top->GetGlobalJSObject());
|
||||
|
@ -346,6 +346,11 @@ XPCWrappedNativeScope::EnsureAddonScope(JSContext *cx, JSAddonId *addonId)
|
||||
MOZ_ASSERT(addonId);
|
||||
MOZ_ASSERT(nsContentUtils::IsSystemPrincipal(GetPrincipal()));
|
||||
|
||||
// If the global is already part of the add-on then there's no reason to
|
||||
// create a new one.
|
||||
if (AddonIdOfObject(global) == addonId)
|
||||
return global;
|
||||
|
||||
// If we already have an addon scope object, we know what to use.
|
||||
for (size_t i = 0; i < mAddonScopes.Length(); i++) {
|
||||
if (JS::AddonIdOfObject(js::UncheckedUnwrap(mAddonScopes[i])) == addonId)
|
||||
|
Loading…
Reference in New Issue
Block a user