mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 935793 (part 2) - rename browser-shown notifications and send them for all frames. r=smaug
This commit is contained in:
parent
303f82047a
commit
e90e6505b7
@ -118,8 +118,8 @@ this.AccessFu = {
|
||||
Output.start();
|
||||
TouchAdapter.start();
|
||||
|
||||
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
|
||||
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', false);
|
||||
Services.obs.addObserver(this, 'remote-browser-shown', false);
|
||||
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
|
||||
Services.obs.addObserver(this, 'Accessibility:NextObject', false);
|
||||
Services.obs.addObserver(this, 'Accessibility:PreviousObject', false);
|
||||
Services.obs.addObserver(this, 'Accessibility:Focus', false);
|
||||
@ -162,8 +162,8 @@ this.AccessFu = {
|
||||
Utils.win.removeEventListener('TabClose', this);
|
||||
Utils.win.removeEventListener('TabSelect', this);
|
||||
|
||||
Services.obs.removeObserver(this, 'remote-browser-frame-shown');
|
||||
Services.obs.removeObserver(this, 'in-process-browser-or-app-frame-shown');
|
||||
Services.obs.removeObserver(this, 'remote-browser-shown');
|
||||
Services.obs.removeObserver(this, 'inprocess-browser-shown');
|
||||
Services.obs.removeObserver(this, 'Accessibility:NextObject');
|
||||
Services.obs.removeObserver(this, 'Accessibility:PreviousObject');
|
||||
Services.obs.removeObserver(this, 'Accessibility:Focus');
|
||||
@ -304,11 +304,15 @@ this.AccessFu = {
|
||||
case 'Accessibility:MoveByGranularity':
|
||||
this.Input.moveByGranularity(JSON.parse(aData));
|
||||
break;
|
||||
case 'remote-browser-frame-shown':
|
||||
case 'in-process-browser-or-app-frame-shown':
|
||||
case 'remote-browser-shown':
|
||||
case 'inprocess-browser-shown':
|
||||
{
|
||||
let mm = aSubject.QueryInterface(Ci.nsIFrameLoader).messageManager;
|
||||
this._handleMessageManager(mm);
|
||||
// Ignore notifications that aren't from a BrowserOrApp
|
||||
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
|
||||
if (!frameLoader.ownerIsBrowserOrAppFrame) {
|
||||
return;
|
||||
}
|
||||
this._handleMessageManager(frameLoader.messageManager);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ let devtoolsWidgetPanel = {
|
||||
}
|
||||
}
|
||||
|
||||
Services.obs.addObserver(this, 'remote-browser-frame-pending', false);
|
||||
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', false);
|
||||
Services.obs.addObserver(this, 'remote-browser-pending', false);
|
||||
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
|
||||
Services.obs.addObserver(this, 'message-manager-disconnect', false);
|
||||
|
||||
let systemapp = document.querySelector('#systemapp');
|
||||
@ -91,8 +91,8 @@ let devtoolsWidgetPanel = {
|
||||
this.untrackApp(manifest);
|
||||
}
|
||||
|
||||
Services.obs.removeObserver(this, 'remote-browser-frame-pending');
|
||||
Services.obs.removeObserver(this, 'in-process-browser-or-app-frame-shown');
|
||||
Services.obs.removeObserver(this, 'remote-browser-pending');
|
||||
Services.obs.removeObserver(this, 'inprocess-browser-shown');
|
||||
Services.obs.removeObserver(this, 'message-manager-disconnect');
|
||||
|
||||
this._client.close();
|
||||
@ -150,11 +150,15 @@ let devtoolsWidgetPanel = {
|
||||
switch(topic) {
|
||||
|
||||
// listen for frame creation in OOP (device) as well as in parent process (b2g desktop)
|
||||
case 'remote-browser-frame-pending':
|
||||
case 'in-process-browser-or-app-frame-shown':
|
||||
case 'remote-browser-pending':
|
||||
case 'inprocess-browser-shown':
|
||||
let frameLoader = subject;
|
||||
// get a ref to the app <iframe>
|
||||
frameLoader.QueryInterface(Ci.nsIFrameLoader);
|
||||
// Ignore notifications that aren't from a BrowserOrApp
|
||||
if (!frameLoader.ownerIsBrowserOrAppFrame) {
|
||||
return;
|
||||
}
|
||||
manifestURL = frameLoader.ownerElement.appManifestURL;
|
||||
if (!manifestURL) // Ignore all frames but apps
|
||||
return;
|
||||
|
@ -170,12 +170,16 @@ let ErrorPage = {
|
||||
},
|
||||
|
||||
init: function errorPageInit() {
|
||||
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', false);
|
||||
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
|
||||
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
|
||||
Services.obs.addObserver(this, 'remote-browser-shown', false);
|
||||
},
|
||||
|
||||
observe: function errorPageObserve(aSubject, aTopic, aData) {
|
||||
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
|
||||
// Ignore notifications that aren't from a BrowserOrApp
|
||||
if (!frameLoader.ownerIsBrowserOrAppFrame) {
|
||||
return;
|
||||
}
|
||||
this._listenError(frameLoader);
|
||||
}
|
||||
};
|
||||
|
@ -462,9 +462,9 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
||||
if (!mRemoteBrowser) {
|
||||
if (!mPendingFrameSent) {
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (OwnerIsBrowserOrAppFrame() && os && !mRemoteBrowserInitialized) {
|
||||
if (os && !mRemoteBrowserInitialized) {
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
|
||||
"remote-browser-frame-pending", nullptr);
|
||||
"remote-browser-pending", nullptr);
|
||||
mPendingFrameSent = true;
|
||||
}
|
||||
}
|
||||
@ -995,14 +995,14 @@ nsFrameLoader::ShowRemoteFrame(const nsIntSize& size,
|
||||
EnsureMessageManager();
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (OwnerIsBrowserOrAppFrame() && os && !mRemoteBrowserInitialized) {
|
||||
if (os && !mRemoteBrowserInitialized) {
|
||||
if (!mPendingFrameSent) {
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
|
||||
"remote-browser-frame-pending", nullptr);
|
||||
"remote-browser-pending", nullptr);
|
||||
mPendingFrameSent = true;
|
||||
}
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
|
||||
"remote-browser-frame-shown", nullptr);
|
||||
"remote-browser-shown", nullptr);
|
||||
mRemoteBrowserInitialized = true;
|
||||
}
|
||||
} else {
|
||||
@ -1723,19 +1723,17 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
mDocShell->SetIsBrowserInsideApp(containingAppId);
|
||||
}
|
||||
|
||||
if (OwnerIsBrowserOrAppFrame()) {
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
|
||||
"in-process-browser-or-app-frame-shown", nullptr);
|
||||
}
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
|
||||
"inprocess-browser-shown", nullptr);
|
||||
}
|
||||
|
||||
if (mMessageManager) {
|
||||
mMessageManager->LoadFrameScript(
|
||||
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
|
||||
/* allowDelayedLoad = */ true,
|
||||
/* aRunInGlobalScope */ true);
|
||||
}
|
||||
if (OwnerIsBrowserOrAppFrame() && mMessageManager) {
|
||||
mMessageManager->LoadFrameScript(
|
||||
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
|
||||
/* allowDelayedLoad = */ true,
|
||||
/* aRunInGlobalScope */ true);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -460,7 +460,7 @@ private:
|
||||
// forwards some input events to out-of-process content.
|
||||
uint32_t mEventMode;
|
||||
|
||||
// Indicate if we have sent 'remote-browser-frame-pending'.
|
||||
// Indicate if we have sent 'remote-browser-pending'.
|
||||
bool mPendingFrameSent;
|
||||
};
|
||||
|
||||
|
@ -65,8 +65,8 @@ BrowserElementParentFactory.prototype = {
|
||||
// alive for as long as its frame element lives.
|
||||
this._bepMap = new WeakMap();
|
||||
|
||||
Services.obs.addObserver(this, 'remote-browser-frame-pending', /* ownsWeak = */ true);
|
||||
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', /* ownsWeak = */ true);
|
||||
Services.obs.addObserver(this, 'remote-browser-pending', /* ownsWeak = */ true);
|
||||
Services.obs.addObserver(this, 'inprocess-browser-shown', /* ownsWeak = */ true);
|
||||
},
|
||||
|
||||
_browserFramesPrefEnabled: function() {
|
||||
@ -79,6 +79,10 @@ BrowserElementParentFactory.prototype = {
|
||||
},
|
||||
|
||||
_observeInProcessBrowserFrameShown: function(frameLoader) {
|
||||
// Ignore notifications that aren't from a BrowserOrApp
|
||||
if (!frameLoader.QueryInterface(Ci.nsIFrameLoader).ownerIsBrowserOrAppFrame) {
|
||||
return;
|
||||
}
|
||||
debug("In-process browser frame shown " + frameLoader);
|
||||
this._createBrowserElementParent(frameLoader,
|
||||
/* hasRemoteFrame = */ false,
|
||||
@ -86,6 +90,10 @@ BrowserElementParentFactory.prototype = {
|
||||
},
|
||||
|
||||
_observeRemoteBrowserFramePending: function(frameLoader) {
|
||||
// Ignore notifications that aren't from a BrowserOrApp
|
||||
if (!frameLoader.QueryInterface(Ci.nsIFrameLoader).ownerIsBrowserOrAppFrame) {
|
||||
return;
|
||||
}
|
||||
debug("Remote browser frame shown " + frameLoader);
|
||||
this._createBrowserElementParent(frameLoader,
|
||||
/* hasRemoteFrame = */ true,
|
||||
@ -108,10 +116,10 @@ BrowserElementParentFactory.prototype = {
|
||||
this._init();
|
||||
}
|
||||
break;
|
||||
case 'remote-browser-frame-pending':
|
||||
case 'remote-browser-pending':
|
||||
this._observeRemoteBrowserFramePending(subject);
|
||||
break;
|
||||
case 'in-process-browser-or-app-frame-shown':
|
||||
case 'inprocess-browser-shown':
|
||||
this._observeInProcessBrowserFrameShown(subject);
|
||||
break;
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ this.Keyboard = {
|
||||
},
|
||||
|
||||
init: function keyboardInit() {
|
||||
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', false);
|
||||
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
|
||||
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
|
||||
Services.obs.addObserver(this, 'remote-browser-shown', false);
|
||||
Services.obs.addObserver(this, 'oop-frameloader-crashed', false);
|
||||
|
||||
for (let name of this._messageNames)
|
||||
@ -71,6 +71,10 @@ this.Keyboard = {
|
||||
this.sendToKeyboard('Keyboard:FocusChange', { 'type': 'blur' });
|
||||
}
|
||||
} else {
|
||||
// Ignore notifications that aren't from a BrowserOrApp
|
||||
if (!frameLoader.ownerIsBrowserOrAppFrame) {
|
||||
return;
|
||||
}
|
||||
this.initFormsFrameScript(mm);
|
||||
}
|
||||
},
|
||||
|
@ -600,7 +600,7 @@ ParticularProcessPriorityManager::Init()
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->AddObserver(this, "audio-channel-process-changed", /* ownsWeak */ true);
|
||||
os->AddObserver(this, "remote-browser-frame-shown", /* ownsWeak */ true);
|
||||
os->AddObserver(this, "remote-browser-shown", /* ownsWeak */ true);
|
||||
os->AddObserver(this, "ipc:browser-destroyed", /* ownsWeak */ true);
|
||||
os->AddObserver(this, "frameloader-visible-changed", /* ownsWeak */ true);
|
||||
}
|
||||
@ -672,7 +672,7 @@ ParticularProcessPriorityManager::Observe(nsISupports* aSubject,
|
||||
|
||||
if (topic.EqualsLiteral("audio-channel-process-changed")) {
|
||||
OnAudioChannelProcessChanged(aSubject);
|
||||
} else if (topic.EqualsLiteral("remote-browser-frame-shown")) {
|
||||
} else if (topic.EqualsLiteral("remote-browser-shown")) {
|
||||
OnRemoteBrowserFrameShown(aSubject);
|
||||
} else if (topic.EqualsLiteral("ipc:browser-destroyed")) {
|
||||
OnTabParentDestroyed(aSubject);
|
||||
@ -745,6 +745,13 @@ ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(nsISupports* aSubjec
|
||||
nsCOMPtr<nsIFrameLoader> fl = do_QueryInterface(aSubject);
|
||||
NS_ENSURE_TRUE_VOID(fl);
|
||||
|
||||
// Ignore notifications that aren't from a BrowserOrApp
|
||||
bool isBrowserOrApp;
|
||||
fl->GetOwnerIsBrowserOrAppFrame(&isBrowserOrApp);
|
||||
if (!isBrowserOrApp) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITabParent> tp;
|
||||
fl->GetTabParent(getter_AddRefs(tp));
|
||||
NS_ENSURE_TRUE_VOID(tp);
|
||||
|
Loading…
Reference in New Issue
Block a user