mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
[f10s] Remove isRootWindow and use currentInnerWindowId instead [r=mfinkle]
This commit is contained in:
parent
fe3f292da7
commit
22ab6bbb0c
@ -17,53 +17,53 @@ let WebProgressListener = {
|
|||||||
notifyFlags |= Ci.nsIWebProgress.NOTIFY_STATE_WINDOW;
|
notifyFlags |= Ci.nsIWebProgress.NOTIFY_STATE_WINDOW;
|
||||||
|
|
||||||
let json = {
|
let json = {
|
||||||
isRootWindow: aWebProgress.DOMWindow == content,
|
windowId: aWebProgress.DOMWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID,
|
||||||
stateFlags: aStateFlags,
|
stateFlags: aStateFlags,
|
||||||
status: aStatus,
|
status: aStatus,
|
||||||
notifyFlags: notifyFlags
|
notifyFlags: notifyFlags
|
||||||
};
|
};
|
||||||
sendAsyncMessage("WebProgress:StateChange", json);
|
sendSyncMessage("WebProgress:StateChange", json);
|
||||||
},
|
},
|
||||||
|
|
||||||
onProgressChange: function onProgressChange(aWebProgress, aRequest, aCurSelf, aMaxSelf, aCurTotal, aMaxTotal) {
|
onProgressChange: function onProgressChange(aWebProgress, aRequest, aCurSelf, aMaxSelf, aCurTotal, aMaxTotal) {
|
||||||
let json = {
|
let json = {
|
||||||
isRootWindow: aWebProgress.DOMWindow == content,
|
windowId: aWebProgress.DOMWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID,
|
||||||
curSelf: aCurSelf,
|
curSelf: aCurSelf,
|
||||||
maxSelf: aMaxSelf,
|
maxSelf: aMaxSelf,
|
||||||
curTotal: aCurTotal,
|
curTotal: aCurTotal,
|
||||||
maxTotal: aMaxTotal
|
maxTotal: aMaxTotal
|
||||||
};
|
};
|
||||||
sendAsyncMessage("WebProgress:ProgressChange", json);
|
sendSyncMessage("WebProgress:ProgressChange", json);
|
||||||
},
|
},
|
||||||
|
|
||||||
onLocationChange: function onLocationChange(aWebProgress, aRequest, aLocationURI) {
|
onLocationChange: function onLocationChange(aWebProgress, aRequest, aLocationURI) {
|
||||||
let location = aLocationURI ? aLocationURI.spec : "";
|
let location = aLocationURI ? aLocationURI.spec : "";
|
||||||
let json = {
|
let json = {
|
||||||
isRootWindow: aWebProgress.DOMWindow == content,
|
windowId: aWebProgress.DOMWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID,
|
||||||
documentURI: aWebProgress.DOMWindow.document.documentURIObject.spec,
|
documentURI: aWebProgress.DOMWindow.document.documentURIObject.spec,
|
||||||
location: location,
|
location: location,
|
||||||
canGoBack: docShell.canGoBack,
|
canGoBack: docShell.canGoBack,
|
||||||
canGoForward: docShell.canGoForward
|
canGoForward: docShell.canGoForward
|
||||||
};
|
};
|
||||||
sendAsyncMessage("WebProgress:LocationChange", json);
|
sendSyncMessage("WebProgress:LocationChange", json);
|
||||||
},
|
},
|
||||||
|
|
||||||
onStatusChange: function onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
|
onStatusChange: function onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
|
||||||
let json = {
|
let json = {
|
||||||
isRootWindow: aWebProgress.DOMWindow == content,
|
windowId: aWebProgress.DOMWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID,
|
||||||
status: aStatus,
|
status: aStatus,
|
||||||
message: aMessage
|
message: aMessage
|
||||||
};
|
};
|
||||||
sendAsyncMessage("WebProgress:StatusChange", json);
|
sendSyncMessage("WebProgress:StatusChange", json);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSecurityChange: function onSecurityChange(aWebProgress, aRequest, aState) {
|
onSecurityChange: function onSecurityChange(aWebProgress, aRequest, aState) {
|
||||||
let json = {
|
let json = {
|
||||||
isRootWindow: aWebProgress.DOMWindow == content,
|
windowId: aWebProgress.DOMWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID,
|
||||||
identity: this._getIdentityData(),
|
identity: this._getIdentityData(),
|
||||||
state: aState
|
state: aState
|
||||||
};
|
};
|
||||||
sendAsyncMessage("WebProgress:SecurityChange", json);
|
sendSyncMessage("WebProgress:SecurityChange", json);
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function QueryInterface(aIID) {
|
QueryInterface: function QueryInterface(aIID) {
|
||||||
@ -211,7 +211,7 @@ let DOMEvents = {
|
|||||||
if (document.documentURIObject.spec == "about:blank")
|
if (document.documentURIObject.spec == "about:blank")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendAsyncMessage("DOMContentLoaded", { });
|
sendSyncMessage("DOMContentLoaded", { });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "pageshow":
|
case "pageshow":
|
||||||
@ -224,7 +224,7 @@ let DOMEvents = {
|
|||||||
persisted: aEvent.persisted
|
persisted: aEvent.persisted
|
||||||
};
|
};
|
||||||
|
|
||||||
sendAsyncMessage(aEvent.type, json);
|
sendSyncMessage(aEvent.type, json);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,12 +241,12 @@ let DOMEvents = {
|
|||||||
popupWindowName: aEvent.popupWindowName
|
popupWindowName: aEvent.popupWindowName
|
||||||
};
|
};
|
||||||
|
|
||||||
sendAsyncMessage("DOMPopupBlocked", json);
|
sendSyncMessage("DOMPopupBlocked", json);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "DOMTitleChanged":
|
case "DOMTitleChanged":
|
||||||
sendAsyncMessage("DOMTitleChanged", { title: document.title });
|
sendSyncMessage("DOMTitleChanged", { title: document.title });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "DOMLinkAdded":
|
case "DOMLinkAdded":
|
||||||
@ -263,7 +263,7 @@ let DOMEvents = {
|
|||||||
type: target.type
|
type: target.type
|
||||||
};
|
};
|
||||||
|
|
||||||
sendAsyncMessage("DOMLinkAdded", json);
|
sendSyncMessage("DOMLinkAdded", json);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "DOMWillOpenModalDialog":
|
case "DOMWillOpenModalDialog":
|
||||||
|
@ -62,6 +62,8 @@
|
|||||||
onget="return gIOService.newURI(this._documentURI, null, null)"
|
onget="return gIOService.newURI(this._documentURI, null, null)"
|
||||||
readonly="true"/>
|
readonly="true"/>
|
||||||
|
|
||||||
|
<field name="contentWindowId">null</field>
|
||||||
|
|
||||||
<property name="messageManager"
|
<property name="messageManager"
|
||||||
onget="return this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.messageManager;"
|
onget="return this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.messageManager;"
|
||||||
readonly="true"/>
|
readonly="true"/>
|
||||||
@ -142,30 +144,132 @@
|
|||||||
|
|
||||||
<field name="_webProgress"><![CDATA[
|
<field name="_webProgress"><![CDATA[
|
||||||
({
|
({
|
||||||
|
_listeners: [],
|
||||||
_browser: this,
|
_browser: this,
|
||||||
|
|
||||||
// We only need the onLocationChange for the local-browser and we don't need
|
|
||||||
// to support holding listeners and firing notifications.
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
|
this._browser.messageManager.addMessageListener("WebProgress:StateChange", this);
|
||||||
|
this._browser.messageManager.addMessageListener("WebProgress:ProgressChange", this);
|
||||||
this._browser.messageManager.addMessageListener("WebProgress:LocationChange", this);
|
this._browser.messageManager.addMessageListener("WebProgress:LocationChange", this);
|
||||||
|
this._browser.messageManager.addMessageListener("WebProgress:StatusChange", this);
|
||||||
|
this._browser.messageManager.addMessageListener("WebProgress:SecurityChange", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addProgressListener: function(aListener, aNotifyFlags) {
|
||||||
|
function hasFilter(item) {
|
||||||
|
return item.listener == aListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._listeners.some(hasFilter))
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._listeners.push({
|
||||||
|
listener: aListener,
|
||||||
|
flags: aNotifyFlags
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
removeProgressListener: function(aListener) {
|
||||||
|
function hasFilter(item) {
|
||||||
|
return item.listener != aListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._listeners = this._listeners.filter(hasFilter);
|
||||||
|
},
|
||||||
|
get DOMWindow() { throw "DOMWindow: Not Remoteable" },
|
||||||
|
get isLoadingDocument() { throw "isLoadingDocument: Not Remoteable"; },
|
||||||
|
|
||||||
receiveMessage: function(aMessage) {
|
receiveMessage: function(aMessage) {
|
||||||
|
let args;
|
||||||
let json = aMessage.json;
|
let json = aMessage.json;
|
||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
|
case "WebProgress:StateChange":
|
||||||
|
args = [
|
||||||
|
{ windowId: json.windowId, browser: this._browser },
|
||||||
|
{},
|
||||||
|
json.stateFlags,
|
||||||
|
json.status
|
||||||
|
];
|
||||||
|
|
||||||
|
this._notify(json.notifyFlags, "onStateChange", args);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "WebProgress:ProgressChange":
|
||||||
|
args = [
|
||||||
|
{ windowId: json.windowId, browser: this._browser },
|
||||||
|
{},
|
||||||
|
json.curSelf,
|
||||||
|
json.maxSelf,
|
||||||
|
json.curTotal,
|
||||||
|
json.maxTotal
|
||||||
|
];
|
||||||
|
this._notify(Components.interfaces.nsIWebProgress.NOTIFY_PROGRESS,
|
||||||
|
"onProgressChange",
|
||||||
|
args);
|
||||||
|
break;
|
||||||
|
|
||||||
case "WebProgress:LocationChange":
|
case "WebProgress:LocationChange":
|
||||||
if (json.isRootWindow) {
|
let locationURI = this._browser._ios.newURI(json.location, null, null);
|
||||||
|
|
||||||
|
args = [
|
||||||
|
{ windowId: json.windowId, browser: this._browser },
|
||||||
|
{},
|
||||||
|
locationURI
|
||||||
|
];
|
||||||
|
|
||||||
|
if (this._browser.contentWindowId != json.windowId) {
|
||||||
|
this._browser.contentWindowId = json.windowId;
|
||||||
this._browser._documentURI = json.documentURI;
|
this._browser._documentURI = json.documentURI;
|
||||||
this._browser._searchEngines = [];
|
this._browser._searchEngines = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._notify(Components.interfaces.nsIWebProgress.NOTIFY_LOCATION,
|
||||||
|
"onLocationChange",
|
||||||
|
args);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "WebProgress:StatusChange":
|
||||||
|
args = [
|
||||||
|
{ windowId: json.windowId, browser: this._browser },
|
||||||
|
{},
|
||||||
|
json.status,
|
||||||
|
json.message
|
||||||
|
];
|
||||||
|
this._notify(Components.interfaces.nsIWebProgress.NOTIFY_STATUS,
|
||||||
|
"onStatusChange",
|
||||||
|
args);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "WebProgress:SecurityChange":
|
||||||
|
args = [
|
||||||
|
{ windowId: json.windowId, browser: this._browser, identity: json.identity },
|
||||||
|
{},
|
||||||
|
json.state
|
||||||
|
];
|
||||||
|
this._notify(Components.interfaces.nsIWebProgress.NOTIFY_SECURITY,
|
||||||
|
"onSecurityChange",
|
||||||
|
args);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
},
|
||||||
|
|
||||||
|
_notify: function(aFlags, aName, aArguments) {
|
||||||
|
this._listeners.forEach(function(item) {
|
||||||
|
if (item.flags & aFlags) {
|
||||||
|
item.listener[aName].apply(item.listener, aArguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]]></field>
|
]]></field>
|
||||||
|
|
||||||
|
<property name="webProgress"
|
||||||
|
readonly="true"
|
||||||
|
onget="return this._webProgress"/>
|
||||||
|
|
||||||
<method name="onPageShow">
|
<method name="onPageShow">
|
||||||
<parameter name="aMessage"/>
|
<parameter name="aMessage"/>
|
||||||
<body>
|
<body>
|
||||||
@ -395,7 +499,7 @@
|
|||||||
this._listeners = this._listeners.filter(hasFilter);
|
this._listeners = this._listeners.filter(hasFilter);
|
||||||
},
|
},
|
||||||
get DOMWindow() { throw "DOMWindow: Not Remoteable" },
|
get DOMWindow() { throw "DOMWindow: Not Remoteable" },
|
||||||
isLoadingDocument: false,
|
get isLoadingDocument() { throw "isLoadingDocument: Not Remoteable"; },
|
||||||
|
|
||||||
receiveMessage: function(aMessage) {
|
receiveMessage: function(aMessage) {
|
||||||
let args;
|
let args;
|
||||||
@ -403,7 +507,7 @@
|
|||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
case "WebProgress:StateChange":
|
case "WebProgress:StateChange":
|
||||||
args = [
|
args = [
|
||||||
{ isRootWindow: json.isRootWindow, browser: this._browser },
|
{ windowId: json.windowId, browser: this._browser },
|
||||||
{},
|
{},
|
||||||
json.stateFlags,
|
json.stateFlags,
|
||||||
json.status
|
json.status
|
||||||
@ -414,7 +518,7 @@
|
|||||||
|
|
||||||
case "WebProgress:ProgressChange":
|
case "WebProgress:ProgressChange":
|
||||||
args = [
|
args = [
|
||||||
{ isRootWindow: json.isRootWindow, browser: this._browser },
|
{ windowId: json.windowId, browser: this._browser },
|
||||||
{},
|
{},
|
||||||
json.curSelf,
|
json.curSelf,
|
||||||
json.maxSelf,
|
json.maxSelf,
|
||||||
@ -427,18 +531,19 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "WebProgress:LocationChange":
|
case "WebProgress:LocationChange":
|
||||||
let currentURI = this._browser._ios.newURI(json.location, null, null);
|
let locationURI = this._browser._ios.newURI(json.location, null, null);
|
||||||
this._browser._webNavigation._currentURI = currentURI;
|
this._browser._webNavigation._currentURI = locationURI;
|
||||||
this._browser._webNavigation.canGoBack = json.canGoBack;
|
this._browser._webNavigation.canGoBack = json.canGoBack;
|
||||||
this._browser._webNavigation.canGoForward = json.canGoForward;
|
this._browser._webNavigation.canGoForward = json.canGoForward;
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
{ isRootWindow: json.isRootWindow, browser: this._browser },
|
{ windowId: json.windowId, browser: this._browser },
|
||||||
{},
|
{},
|
||||||
currentURI
|
locationURI
|
||||||
];
|
];
|
||||||
|
|
||||||
if (json.isRootWindow) {
|
if (this._browser.contentWindowId != json.windowId) {
|
||||||
|
this._browser.contentWindowId = json.windowId;
|
||||||
this._browser._documentURI = json.documentURI;
|
this._browser._documentURI = json.documentURI;
|
||||||
this._browser._searchEngines = [];
|
this._browser._searchEngines = [];
|
||||||
}
|
}
|
||||||
@ -451,7 +556,7 @@
|
|||||||
|
|
||||||
case "WebProgress:StatusChange":
|
case "WebProgress:StatusChange":
|
||||||
args = [
|
args = [
|
||||||
{ isRootWindow: json.isRootWindow, browser: this._browser },
|
{ windowId: json.windowId, browser: this._browser },
|
||||||
{},
|
{},
|
||||||
json.status,
|
json.status,
|
||||||
json.message
|
json.message
|
||||||
@ -463,7 +568,7 @@
|
|||||||
|
|
||||||
case "WebProgress:SecurityChange":
|
case "WebProgress:SecurityChange":
|
||||||
args = [
|
args = [
|
||||||
{ isRootWindow: json.isRootWindow, browser: this._browser, identity: json.identity },
|
{ windowId: json.windowId, browser: this._browser, identity: json.identity },
|
||||||
{},
|
{},
|
||||||
json.state
|
json.state
|
||||||
];
|
];
|
||||||
@ -485,10 +590,6 @@
|
|||||||
})
|
})
|
||||||
]]></field>
|
]]></field>
|
||||||
|
|
||||||
<property name="webProgress"
|
|
||||||
readonly="true"
|
|
||||||
onget="return this._webProgress"/>
|
|
||||||
|
|
||||||
<property name="contentWindow"
|
<property name="contentWindow"
|
||||||
readonly="true"
|
readonly="true"
|
||||||
onget="throw 'Not Remoteable'"/>
|
onget="throw 'Not Remoteable'"/>
|
||||||
|
@ -2715,7 +2715,7 @@ ProgressController.prototype = {
|
|||||||
|
|
||||||
onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
|
onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||||
// ignore notification that aren't about the main document (iframes, etc)
|
// ignore notification that aren't about the main document (iframes, etc)
|
||||||
if (aWebProgress.DOMWindow != this._tab.browser.contentWindow)
|
if (aWebProgress.windowId != this._tab.browser.contentWindowId && this._tab.browser.contentWindowId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If you want to observe other state flags, be sure they're listed in the
|
// If you want to observe other state flags, be sure they're listed in the
|
||||||
@ -2748,7 +2748,7 @@ ProgressController.prototype = {
|
|||||||
/** This method is called to indicate a change to the current location. */
|
/** This method is called to indicate a change to the current location. */
|
||||||
onLocationChange: function onLocationChange(aWebProgress, aRequest, aLocationURI) {
|
onLocationChange: function onLocationChange(aWebProgress, aRequest, aLocationURI) {
|
||||||
// ignore notification that aren't about the main document (iframes, etc)
|
// ignore notification that aren't about the main document (iframes, etc)
|
||||||
if (aWebProgress.DOMWindow != this._tab.browser.contentWindow)
|
if (aWebProgress.windowId != this._tab.browser.contentWindowId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let spec = aLocationURI ? aLocationURI.spec : "";
|
let spec = aLocationURI ? aLocationURI.spec : "";
|
||||||
|
Loading…
Reference in New Issue
Block a user