mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1527905. Switch from zone-per-tab to zone-per-toplevel-load. r=mccr8
The main reason for this change is that we don't really want to share compartments across same-origin navigations in the same tab (because that will tend to keep the oldest global involved alive, due to CCWs and XPCWrappedNatives allocated in that global). We could somehow flag compartments as not sharable when we navigate, but it's simpler to just switch zones, since we restrict our search of shareable compartments to a single zone. A side benefit is that this way the lifetime of objects in a single zone is more likely to be similar. Differential Revision: https://phabricator.services.mozilla.com/D19797 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
271bc01510
commit
8a0e2dabbe
@ -1796,6 +1796,12 @@ static JS::RealmCreationOptions& SelectZone(
|
||||
|
||||
if (aNewInner->GetOuterWindow()) {
|
||||
nsGlobalWindowOuter* top = aNewInner->GetTopInternal();
|
||||
if (top == aNewInner->GetOuterWindow()) {
|
||||
// We're a toplevel load. Use a new zone. This way, when we do
|
||||
// zone-based compartment sharing we won't share compartments
|
||||
// across navigations.
|
||||
return aOptions.setNewCompartmentAndZone();
|
||||
}
|
||||
|
||||
// If we have a top-level window, use its zone.
|
||||
if (top && top->GetGlobalJSObject()) {
|
||||
|
Loading…
Reference in New Issue
Block a user