mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1077652 - SessionStore should accept :setupSyncHandler and :update messages from browsers without tabs r=smacleod
By making SessionStore accept :setupSyncHandler and :update messages from <xul:browser>s without a tab assigned we can preload a <xul:browser> in the background and assign a tab later. SessionStore will have the correct sync handler and know about the current content loaded in that browser. If the browser will never be assigned to a tab the received data will simply be discarded when the browser goes away due to the use of WeakMaps in SessionStore.
This commit is contained in:
parent
a6a92d0eeb
commit
39ea4c06d0
@ -74,6 +74,16 @@ const FMM_MESSAGES = [
|
||||
"SessionStore:reloadPendingTab",
|
||||
];
|
||||
|
||||
// The list of messages we accept from <xul:browser>s that have no tab
|
||||
// assigned. Those are for example the ones that preload about:newtab pages.
|
||||
const FMM_NOTAB_MESSAGES = new Set([
|
||||
// For a description see above.
|
||||
"SessionStore:setupSyncHandler",
|
||||
|
||||
// For a description see above.
|
||||
"SessionStore:update",
|
||||
]);
|
||||
|
||||
// Messages that will be received via the Parent Process Message Manager.
|
||||
const PPMM_MESSAGES = [
|
||||
// A tab is being revived from the crashed state. The sender of this
|
||||
@ -605,9 +615,12 @@ let SessionStoreInternal = {
|
||||
var browser = aMessage.target;
|
||||
var win = browser.ownerDocument.defaultView;
|
||||
let tab = win.gBrowser.getTabForBrowser(browser);
|
||||
if (!tab) {
|
||||
// Ignore messages from <browser> elements that are not tabs.
|
||||
return;
|
||||
|
||||
// Ensure we receive only specific messages from <xul:browser>s that
|
||||
// have no tab assigned, e.g. the ones that preload aobut:newtab pages.
|
||||
if (!tab && !FMM_NOTAB_MESSAGES.has(aMessage.name)) {
|
||||
throw new Error(`received unexpected message '${aMessage.name}' ` +
|
||||
`from a browser that has no tab`);
|
||||
}
|
||||
|
||||
switch (aMessage.name) {
|
||||
@ -691,7 +704,7 @@ let SessionStoreInternal = {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debug(`received unknown message '${aMessage.name}'`);
|
||||
throw new Error(`received unknown message '${aMessage.name}'`);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user