2010-06-07 19:44:06 -07:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
<!-- ***** BEGIN LICENSE BLOCK *****
|
|
|
|
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
-
|
|
|
|
- The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
- 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
- the License. You may obtain a copy of the License at
|
|
|
|
- http://www.mozilla.org/MPL/
|
|
|
|
-
|
|
|
|
- Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
- for the specific language governing rights and limitations under the
|
|
|
|
- License.
|
|
|
|
-
|
|
|
|
- The Original Code is this file as it was released on March 28, 2001.
|
|
|
|
-
|
|
|
|
- The Initial Developer of the Original Code is
|
|
|
|
- Peter Annema.
|
|
|
|
- Portions created by the Initial Developer are Copyright (C) 2001
|
|
|
|
- the Initial Developer. All Rights Reserved.
|
|
|
|
-
|
|
|
|
- Contributor(s):
|
|
|
|
- Peter Annema <disttsc@bart.nl> (Original Author of <browser>)
|
|
|
|
- Peter Parente <parente@cs.unc.edu>
|
|
|
|
- Christopher Thomas <cst@yecc.com>
|
|
|
|
- Michael Ventnor <m.ventnor@gmail.com>
|
|
|
|
- Arpad Borsos <arpad.borsos@googlemail.com>
|
|
|
|
-
|
|
|
|
- Alternatively, the contents of this file may be used under the terms of
|
|
|
|
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
- in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
- of those above. If you wish to allow use of your version of this file only
|
|
|
|
- under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
- use your version of this file under the terms of the MPL, indicate your
|
|
|
|
- decision by deleting the provisions above and replace them with the notice
|
|
|
|
- and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
- the provisions above, a recipient may use your version of this file under
|
|
|
|
- the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
-
|
|
|
|
- ***** END LICENSE BLOCK ***** -->
|
|
|
|
|
|
|
|
<!DOCTYPE bindings [
|
|
|
|
<!ENTITY % findBarDTD SYSTEM "chrome://global/locale/findbar.dtd" >
|
|
|
|
%findBarDTD;
|
|
|
|
]>
|
|
|
|
|
|
|
|
<bindings id="remoteBrowserBindings"
|
|
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
|
2010-06-08 12:30:46 -07:00
|
|
|
<binding id="local-browser" extends="chrome://global/content/bindings/browser.xml#browser">
|
2010-06-07 19:44:06 -07:00
|
|
|
<implementation type="application/javascript" implements="nsIAccessibleProvider, nsIObserver, nsIDOMEventListener, nsIFrameMessageListener">
|
|
|
|
<field name="_searchEngines">[]</field>
|
|
|
|
<property name="searchEngines"
|
|
|
|
onget="return this._searchEngines"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2010-06-08 08:22:20 -07:00
|
|
|
<field name="_documentURI">null</field>
|
|
|
|
<property name="documentURI"
|
|
|
|
onget="return gIOService.newURI(this._documentURI, null, null)"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2010-06-09 13:07:32 -07:00
|
|
|
<field name="contentWindowId">null</field>
|
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
<property name="messageManager"
|
|
|
|
onget="return this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.messageManager;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<field name="_contentTitle">null</field>
|
|
|
|
|
|
|
|
<field name="_ios">
|
|
|
|
Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
|
|
|
|
</field>
|
|
|
|
|
|
|
|
<method name="receiveMessage">
|
|
|
|
<parameter name="aMessage"/>
|
|
|
|
<body><![CDATA[
|
|
|
|
switch (aMessage.name) {
|
2010-06-08 08:22:20 -07:00
|
|
|
case "DOMContentLoaded":
|
2010-06-07 19:44:06 -07:00
|
|
|
let data = aMessage.json;
|
|
|
|
if (this.mIconURL == "") {
|
2010-06-08 08:22:20 -07:00
|
|
|
this.mIconURL = this.documentURI.prePath + "/favicon.ico";
|
2010-06-07 19:44:06 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-06-08 08:22:20 -07:00
|
|
|
case "DOMPopupBlocked":
|
|
|
|
this.onPopupBlocked(aMessage);
|
2010-06-07 19:44:06 -07:00
|
|
|
break;
|
2010-06-08 08:22:20 -07:00
|
|
|
|
|
|
|
case "pageshow":
|
|
|
|
this.onPageShow(aMessage);
|
2010-06-07 19:44:06 -07:00
|
|
|
break;
|
2010-06-08 08:22:20 -07:00
|
|
|
|
|
|
|
case "pagehide":
|
|
|
|
this.onPageHide(aMessage);
|
2010-06-07 19:44:06 -07:00
|
|
|
break;
|
2010-06-08 08:22:20 -07:00
|
|
|
|
|
|
|
case "DOMTitleChanged":
|
|
|
|
this._contentTitle = aMessage.json.title;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "DOMLinkAdded":
|
2010-06-07 19:44:06 -07:00
|
|
|
let link = aMessage.json;
|
2010-06-08 08:22:20 -07:00
|
|
|
if (link.location != this._documentURI)
|
2010-06-07 19:44:06 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
let linkType = this._getLinkType(link);
|
|
|
|
switch(linkType) {
|
|
|
|
case "icon":
|
2010-06-08 08:22:20 -07:00
|
|
|
let iconURI = gIOService.newURI(link.href, link.charset, null);
|
2010-06-07 19:44:06 -07:00
|
|
|
if (!iconURI.schemeIs("javascript") && !gFaviconService.isFailedFavicon(iconURI)) {
|
|
|
|
gFaviconService.setAndLoadFaviconForPage(this.currentURI, iconURI, true);
|
|
|
|
this.mIconURL = iconURI.spec;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "search":
|
|
|
|
this._searchEngines.push({ title: link.title, href: link.href });
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="_getLinkType">
|
|
|
|
<parameter name="aLink" />
|
|
|
|
<body><![CDATA[
|
|
|
|
let type = "";
|
|
|
|
if (/\bicon\b/i(aLink.rel)) {
|
|
|
|
type = "icon";
|
|
|
|
}
|
|
|
|
else if (/\bsearch\b/i(aLink.rel) && aLink.type && aLink.title) {
|
|
|
|
let linkType = aLink.type.replace(/^\s+|\s*(?:;.*)?$/g, "").toLowerCase();
|
|
|
|
if (linkType == "application/opensearchdescription+xml" && /^(?:https?|ftp):/i.test(aLink.href)) {
|
|
|
|
type = "search";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
]]></body>
|
|
|
|
</method>
|
|
|
|
|
2010-06-08 12:30:46 -07:00
|
|
|
<field name="_webProgress"><![CDATA[
|
|
|
|
({
|
2010-06-09 13:07:32 -07:00
|
|
|
_listeners: [],
|
2010-06-08 19:36:04 -07:00
|
|
|
_browser: this,
|
|
|
|
|
2010-06-08 12:30:46 -07:00
|
|
|
_init: function() {
|
2010-06-09 13:07:32 -07:00
|
|
|
this._browser.messageManager.addMessageListener("WebProgress:StateChange", this);
|
|
|
|
this._browser.messageManager.addMessageListener("WebProgress:ProgressChange", this);
|
2010-06-08 12:30:46 -07:00
|
|
|
this._browser.messageManager.addMessageListener("WebProgress:LocationChange", this);
|
2010-06-09 13:07:32 -07:00
|
|
|
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
|
|
|
|
});
|
2010-06-08 12:30:46 -07:00
|
|
|
},
|
2010-06-07 19:44:06 -07:00
|
|
|
|
2010-06-09 13:07:32 -07:00
|
|
|
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"; },
|
|
|
|
|
2010-06-08 12:30:46 -07:00
|
|
|
receiveMessage: function(aMessage) {
|
2010-06-09 13:07:32 -07:00
|
|
|
let args;
|
2010-06-08 12:30:46 -07:00
|
|
|
let json = aMessage.json;
|
|
|
|
switch (aMessage.name) {
|
2010-06-09 13:07:32 -07:00
|
|
|
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;
|
|
|
|
|
2010-06-08 12:30:46 -07:00
|
|
|
case "WebProgress:LocationChange":
|
2010-06-09 13:07:32 -07:00
|
|
|
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;
|
2010-06-08 12:30:46 -07:00
|
|
|
this._browser._documentURI = json.documentURI;
|
|
|
|
this._browser._searchEngines = [];
|
|
|
|
}
|
2010-06-09 13:07:32 -07:00
|
|
|
|
|
|
|
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);
|
2010-06-08 12:30:46 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {};
|
2010-06-09 13:07:32 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
_notify: function(aFlags, aName, aArguments) {
|
|
|
|
this._listeners.forEach(function(item) {
|
|
|
|
if (item.flags & aFlags) {
|
|
|
|
item.listener[aName].apply(item.listener, aArguments);
|
|
|
|
}
|
|
|
|
});
|
2010-06-08 12:30:46 -07:00
|
|
|
}
|
|
|
|
})
|
|
|
|
]]></field>
|
|
|
|
|
2010-06-09 13:07:32 -07:00
|
|
|
<property name="webProgress"
|
|
|
|
readonly="true"
|
|
|
|
onget="return this._webProgress"/>
|
|
|
|
|
2010-06-08 12:30:46 -07:00
|
|
|
<method name="onPageShow">
|
|
|
|
<parameter name="aMessage"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
this.attachFormFill();
|
|
|
|
if (this.pageReport) {
|
|
|
|
var json = aMessage.json;
|
|
|
|
var i = 0;
|
|
|
|
while (i < this.pageReport.length) {
|
|
|
|
// Filter out irrelevant reports.
|
|
|
|
if (this.pageReport[i].requestingWindowId == json.windowId)
|
|
|
|
i++;
|
|
|
|
else
|
|
|
|
this.pageReport.splice(i, 1);
|
|
|
|
}
|
|
|
|
if (this.pageReport.length == 0) {
|
|
|
|
this.pageReport = null;
|
|
|
|
this.updatePageReport();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="onPageHide">
|
|
|
|
<parameter name="aMessage"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (this.pageReport) {
|
|
|
|
this.pageReport = null;
|
|
|
|
this.updatePageReport();
|
|
|
|
}
|
|
|
|
// Delete the feeds cache if we're hiding the topmost page
|
|
|
|
// (as opposed to one of its iframes).
|
|
|
|
// XXX e10s contentDocument is not accessible, we need to use
|
|
|
|
// outerWindowID
|
|
|
|
if (this.feeds && aMessage.target == this.contentDocument)
|
|
|
|
this.feeds = null;
|
|
|
|
if (!this.docShell || !this.fastFind)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var tabBrowser = this.getTabBrowser();
|
|
|
|
if (!tabBrowser || tabBrowser.mCurrentBrowser == this)
|
|
|
|
this.fastFind.setDocShell(this.docShell);
|
|
|
|
|
|
|
|
if (this._scrollable)
|
|
|
|
this._autoScrollPopup.hidePopup();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<method name="onPopupBlocked">
|
|
|
|
<parameter name="aMessage"/>
|
|
|
|
<body>
|
|
|
|
<![CDATA[
|
|
|
|
if (!this.pageReport) {
|
|
|
|
this.pageReport = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
let json = aMessage.json;
|
|
|
|
// XXX Replacing requestingWindow && requestingDocument affects
|
|
|
|
// http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#500
|
|
|
|
var obj = {
|
|
|
|
requestingWindowId: json.windowId,
|
|
|
|
popupWindowURI: gIOService.newURI(json.popupWindowURI.spec, json.popupWindowURI.charset, null),
|
|
|
|
popupWindowFeatures: json.popupWindowFeatures,
|
|
|
|
popupWindowName: json.popupWindowName
|
|
|
|
};
|
|
|
|
|
|
|
|
this.pageReport.push(obj);
|
|
|
|
this.pageReport.reported = false;
|
|
|
|
this.updatePageReport();
|
|
|
|
]]>
|
|
|
|
</body>
|
|
|
|
</method>
|
|
|
|
|
|
|
|
<constructor>
|
2010-06-07 19:44:06 -07:00
|
|
|
<![CDATA[
|
2010-06-08 12:30:46 -07:00
|
|
|
try {
|
|
|
|
if (!this.hasAttribute("disablehistory")) {
|
|
|
|
var os = Components.classes["@mozilla.org/observer-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIObserverService);
|
|
|
|
os.addObserver(this, "browser:purge-session-history", false);
|
|
|
|
// wire up session history
|
|
|
|
this.webNavigation.sessionHistory =
|
|
|
|
Components.classes["@mozilla.org/browser/shistory;1"]
|
|
|
|
.createInstance(Components.interfaces.nsISHistory);
|
|
|
|
// enable global history
|
|
|
|
this.docShell.QueryInterface(Components.interfaces.nsIDocShellHistory).useGlobalHistory = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
Components.utils.reportError(e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
var securityUI = this.securityUI;
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
}
|
|
|
|
|
|
|
|
messageManager.loadFrameScript("chrome://browser/content/bindings/browser.js", true);
|
|
|
|
messageManager.addMessageListener("DOMContentLoaded", this);
|
|
|
|
messageManager.addMessageListener("DOMTitleChanged", this);
|
|
|
|
messageManager.addMessageListener("DOMLinkAdded", this);
|
|
|
|
|
|
|
|
// Listen for first load for lazy attachment to form fill controller
|
|
|
|
messageManager.addMessageListener("pageshow", this);
|
|
|
|
messageManager.addMessageListener("pagehide", this);
|
|
|
|
messageManager.addMessageListener("DOMPopupBlocked", this);
|
|
|
|
|
|
|
|
this._webProgress._init();
|
2010-06-07 19:44:06 -07:00
|
|
|
]]>
|
2010-06-08 12:30:46 -07:00
|
|
|
</constructor>
|
|
|
|
|
|
|
|
</implementation>
|
|
|
|
|
|
|
|
</binding>
|
|
|
|
|
|
|
|
<binding id="remote-browser" extends="#local-browser">
|
|
|
|
<implementation type="application/javascript" implements="nsIAccessibleProvider, nsIObserver, nsIDOMEventListener, nsIFrameMessageListener">
|
|
|
|
<property name="accessibleType" readonly="true">
|
|
|
|
<getter>
|
|
|
|
<![CDATA[
|
|
|
|
throw "accessibleType: Supports Remote?";
|
|
|
|
]]>
|
2010-06-07 19:44:06 -07:00
|
|
|
</getter>
|
|
|
|
</property>
|
|
|
|
|
2010-06-08 12:30:46 -07:00
|
|
|
<property name="autoscrollEnabled">
|
2010-06-07 19:44:06 -07:00
|
|
|
<getter>
|
2010-06-08 12:30:46 -07:00
|
|
|
<![CDATA[
|
|
|
|
throw "autoscrollEnabled: Supports Remote?";
|
|
|
|
]]>
|
2010-06-07 19:44:06 -07:00
|
|
|
</getter>
|
|
|
|
</property>
|
|
|
|
|
2010-06-08 12:30:46 -07:00
|
|
|
<property name="docShell"
|
|
|
|
onget="throw 'docShell: Not Remotable'"
|
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<field name="_contentTitle">null</field>
|
|
|
|
<field name="_contentDocument"><![CDATA[
|
|
|
|
({
|
|
|
|
get title() { return this._browser._contentTitle; },
|
|
|
|
get location() { return null; },
|
|
|
|
set location(aURI) { this._browser.loadURI(aURI, null, null); },
|
|
|
|
get nodePrincipal() { throw "nodePrincipal: Not Remotable"; },
|
|
|
|
|
|
|
|
_browser: this,
|
|
|
|
})
|
|
|
|
]]></field>
|
|
|
|
|
|
|
|
<field name="_webNavigation"><![CDATA[
|
|
|
|
({
|
|
|
|
canGoBack: false,
|
|
|
|
canGoForward: false,
|
|
|
|
goBack: function() { this._sendSyncMessage("WebNavigation:GoBack", {}); },
|
|
|
|
goForward: function() { this._sendSyncMessage("WebNavigation:GoForward", {}); },
|
|
|
|
gotoIndex: function(aIndex) { this._sendSyncMessage("WebNavigation:GotoIndex", {index: aIndex}); },
|
|
|
|
loadURI: function(aURI, aLoadFlags, aReferrer, aPostData, aHeaders) {
|
|
|
|
this._currentURI = this._browser._ios.newURI(aURI, null, null);
|
|
|
|
this._browser._contentTitle = "";
|
|
|
|
this._sendSyncMessage("WebNavigation:LoadURI", {uri: aURI, flags: aLoadFlags});
|
|
|
|
},
|
|
|
|
reload: function(aReloadFlags) { this._sendSyncMessage("WebNavigation:Reload", {flags: aReloadFlags}); },
|
|
|
|
stop: function(aStopFlags) { this._sendSyncMessage("WebNavigation:Stop", {flags: aStopFlags}); },
|
|
|
|
get document() { return this._browser._contentDocument; },
|
|
|
|
get currentURI() {
|
|
|
|
if (!this._currentURI)
|
|
|
|
this._currentURI = this._browser._ios.newURI("about:blank", null, null);
|
|
|
|
|
|
|
|
return this._currentURI;
|
|
|
|
},
|
|
|
|
set currentURI(aURI) { this.loadURI(aURI.spec, null, null, null); },
|
|
|
|
referringURI: null,
|
|
|
|
get sessionHistory() { throw "sessionHistory: Not Remoteable"; },
|
|
|
|
|
|
|
|
_currentURI: null,
|
|
|
|
_browser: this,
|
|
|
|
_sendSyncMessage: function(aMessage, aData) {
|
|
|
|
try {
|
|
|
|
this._browser.messageManager.sendAsyncMessage(aMessage, aData);
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
Components.utils.reportError(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]]></field>
|
|
|
|
|
|
|
|
<property name="webNavigation"
|
|
|
|
onget="return this._webNavigation;"
|
|
|
|
readonly="true"/>
|
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
<field name="_webProgress"><![CDATA[
|
|
|
|
({
|
|
|
|
_listeners: [],
|
|
|
|
_browser: this,
|
|
|
|
|
|
|
|
_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:StatusChange", this);
|
|
|
|
this._browser.messageManager.addMessageListener("WebProgress:SecurityChange", this);
|
|
|
|
},
|
|
|
|
|
|
|
|
addProgressListener: function(aListener, aNotifyFlags) {
|
|
|
|
function hasFilter(item) {
|
|
|
|
return item.listener == aListener;
|
|
|
|
}
|
2010-06-09 13:07:32 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
if (this._listeners.some(hasFilter))
|
|
|
|
return;
|
2010-06-09 13:07:32 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
this._listeners.push({
|
|
|
|
listener: aListener,
|
|
|
|
flags: aNotifyFlags
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
removeProgressListener: function(aListener) {
|
|
|
|
function hasFilter(item) {
|
|
|
|
return item.listener != aListener;
|
|
|
|
}
|
2010-06-08 08:22:20 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
this._listeners = this._listeners.filter(hasFilter);
|
|
|
|
},
|
2010-06-08 08:22:20 -07:00
|
|
|
get DOMWindow() { throw "DOMWindow: Not Remoteable" },
|
2010-06-09 13:07:32 -07:00
|
|
|
get isLoadingDocument() { throw "isLoadingDocument: Not Remoteable"; },
|
2010-06-08 08:22:20 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
receiveMessage: function(aMessage) {
|
|
|
|
let args;
|
2010-06-08 08:22:20 -07:00
|
|
|
let json = aMessage.json;
|
2010-06-07 19:44:06 -07:00
|
|
|
switch (aMessage.name) {
|
|
|
|
case "WebProgress:StateChange":
|
|
|
|
args = [
|
2010-06-09 13:07:32 -07:00
|
|
|
{ windowId: json.windowId, browser: this._browser },
|
2010-06-07 19:44:06 -07:00
|
|
|
{},
|
2010-06-08 08:22:20 -07:00
|
|
|
json.stateFlags,
|
|
|
|
json.status
|
2010-06-07 19:44:06 -07:00
|
|
|
];
|
2010-06-08 08:22:20 -07:00
|
|
|
|
|
|
|
this._notify(json.notifyFlags, "onStateChange", args);
|
2010-06-07 19:44:06 -07:00
|
|
|
break;
|
2010-06-08 08:22:20 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
case "WebProgress:ProgressChange":
|
|
|
|
args = [
|
2010-06-09 13:07:32 -07:00
|
|
|
{ windowId: json.windowId, browser: this._browser },
|
2010-06-07 19:44:06 -07:00
|
|
|
{},
|
2010-06-08 08:22:20 -07:00
|
|
|
json.curSelf,
|
|
|
|
json.maxSelf,
|
|
|
|
json.curTotal,
|
|
|
|
json.maxTotal
|
2010-06-07 19:44:06 -07:00
|
|
|
];
|
|
|
|
this._notify(Components.interfaces.nsIWebProgress.NOTIFY_PROGRESS,
|
|
|
|
"onProgressChange",
|
|
|
|
args);
|
|
|
|
break;
|
2010-06-08 08:22:20 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
case "WebProgress:LocationChange":
|
2010-06-09 13:07:32 -07:00
|
|
|
let locationURI = this._browser._ios.newURI(json.location, null, null);
|
|
|
|
this._browser._webNavigation._currentURI = locationURI;
|
2010-06-08 12:30:46 -07:00
|
|
|
this._browser._webNavigation.canGoBack = json.canGoBack;
|
|
|
|
this._browser._webNavigation.canGoForward = json.canGoForward;
|
2010-06-07 19:44:06 -07:00
|
|
|
|
|
|
|
args = [
|
2010-06-09 13:07:32 -07:00
|
|
|
{ windowId: json.windowId, browser: this._browser },
|
2010-06-07 19:44:06 -07:00
|
|
|
{},
|
2010-06-09 13:07:32 -07:00
|
|
|
locationURI
|
2010-06-07 19:44:06 -07:00
|
|
|
];
|
2010-06-08 08:22:20 -07:00
|
|
|
|
2010-06-09 13:07:32 -07:00
|
|
|
if (this._browser.contentWindowId != json.windowId) {
|
|
|
|
this._browser.contentWindowId = json.windowId;
|
2010-06-08 08:22:20 -07:00
|
|
|
this._browser._documentURI = json.documentURI;
|
|
|
|
this._browser._searchEngines = [];
|
|
|
|
}
|
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
this._notify(Components.interfaces.nsIWebProgress.NOTIFY_LOCATION,
|
|
|
|
"onLocationChange",
|
|
|
|
args);
|
|
|
|
|
|
|
|
break;
|
2010-06-08 08:22:20 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
case "WebProgress:StatusChange":
|
|
|
|
args = [
|
2010-06-09 13:07:32 -07:00
|
|
|
{ windowId: json.windowId, browser: this._browser },
|
2010-06-07 19:44:06 -07:00
|
|
|
{},
|
2010-06-08 08:22:20 -07:00
|
|
|
json.status,
|
|
|
|
json.message
|
2010-06-07 19:44:06 -07:00
|
|
|
];
|
|
|
|
this._notify(Components.interfaces.nsIWebProgress.NOTIFY_STATUS,
|
|
|
|
"onStatusChange",
|
|
|
|
args);
|
|
|
|
break;
|
2010-06-08 08:22:20 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
case "WebProgress:SecurityChange":
|
|
|
|
args = [
|
2010-06-09 13:07:32 -07:00
|
|
|
{ windowId: json.windowId, browser: this._browser, identity: json.identity },
|
2010-06-07 19:44:06 -07:00
|
|
|
{},
|
2010-06-08 08:22:20 -07:00
|
|
|
json.state
|
2010-06-07 19:44:06 -07:00
|
|
|
];
|
|
|
|
this._notify(Components.interfaces.nsIWebProgress.NOTIFY_SECURITY,
|
|
|
|
"onSecurityChange",
|
|
|
|
args);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {};
|
|
|
|
},
|
2010-06-08 08:22:20 -07:00
|
|
|
|
2010-06-07 19:44:06 -07:00
|
|
|
_notify: function(aFlags, aName, aArguments) {
|
|
|
|
this._listeners.forEach(function(item) {
|
|
|
|
if (item.flags & aFlags)
|
|
|
|
item.listener[aName].apply(item.listener, aArguments);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]]></field>
|
|
|
|
|
|
|
|
<property name="contentWindow"
|
|
|
|
readonly="true"
|
|
|
|
onget="throw 'Not Remoteable'"/>
|
|
|
|
|
|
|
|
<property name="sessionHistory"
|
2010-06-08 08:22:20 -07:00
|
|
|
onget="throw 'sessionHistory: Not Remoteable'"
|
2010-06-07 19:44:06 -07:00
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="markupDocumentViewer"
|
2010-06-08 08:22:20 -07:00
|
|
|
onget="throw 'markupDocumentViewer: Not Remoteable'"
|
2010-06-07 19:44:06 -07:00
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="contentViewerEdit"
|
2010-06-08 08:22:20 -07:00
|
|
|
onget="throw 'contentViewerEdit: Not Remoteable'"
|
2010-06-07 19:44:06 -07:00
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="contentViewerFile"
|
2010-06-08 08:22:20 -07:00
|
|
|
onget="throw 'contentViewerFile: Not Remoteable'"
|
2010-06-07 19:44:06 -07:00
|
|
|
readonly="true"/>
|
|
|
|
|
|
|
|
<property name="documentCharsetInfo"
|
2010-06-08 08:22:20 -07:00
|
|
|
onget="throw 'documentCharsetInfo: Not Remoteable'"
|
2010-06-07 19:44:06 -07:00
|
|
|
readonly="true"/>
|
|
|
|
</implementation>
|
|
|
|
|
|
|
|
</binding>
|
|
|
|
|
|
|
|
</bindings>
|