mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
ee05861206
- Bug 1187056 - Dispatch the meta tag mutation events sooner so that any meta-viewport changes can be processed before scripts continue running. r=smaug (2e6f76079f)
- Bug 1238804. Make <base> actually work in a srcdoc document. r=smaug (a421e7c598)
- Bug 1239585 - Remove eSupportSVG from nsObjectLoadingContent capabilities; r=bz (68a79ef21b)
- Bug 1170572 - MQ CSS change not observed by picture source elements r=jdm (efc0be616e)
- Bug 1206720 - Remove invalid assertions during response image loading. r=jdm (0b6485de95)
- Bug 1229032 - don't copy arrays in PerformanceObserver::Observe; r=baku (f1b70e0bd2)
- Bug 1241840 - Set table cell colspan=0 to 1 instead per the HTML spec. r=bz (1900962d4c)
- Bug 812899 part 1. Split the "image is overflow" concept in ImageDocument into two separate booleans for vertical and horizontal overflow. r=khuey (8735b610f3)
- Bug 812899 part 2. Change the centering code in nsImageDocument to only try vertically centering via auto margins when we're not overflowing in the vertical direction, because if we _are_ overflowing that should cut off part of the image per spec. r=khuey (c3b84a8048)
- Bug 812899 part 3 - Make vertical 'auto' margins on absolutely positioned elements always center, even when the margins are negative. r=dbaron (e345fb9383)
- Bug 1238427 - Avoid a strong reference from the timeout timer to nsGeolocationRequest. r=jdm (2ad4dd3955)
- Bug 1240906 - Shut down geolocation service at xpcom-shutdown instead of quit-application. r=dougt (1e7fc9e624)
- Bug 1129633 - part1. Use win8 geolocation with a fallback to MLS - r=m_kato (3323b4a120)
- Bug 1145111: ensure the pos. cache isn't reset when nsGeolocationService shuts down provider. r=jdm (e69cab889a)
- Bug 1240664 - Only enable bug 1216148's behavior when there is a wakelock support. r=kanru (543a3a55b4)
- Bug 1240766 - Fix startup crash in Geolocation::Init() when principal URI is null r=jdm (1ece684418)
- Bug 1238873 - Handle the bug that if we take cached data, we might not get any update later. r=kchen. r=jdm. (ca186e89b3)
- Bug 1240666 - Follow-up to bug 1216148. r=kchen. (3f650b5f72)
- Bug 1227119 - Set a default value for variable ret. r=dougt (5b68dd1a22)
- Bug 1027734 - Convert mozPay to WebIDL. r=bzbarsky. (a4fd10d539)
- Bug 1214488 - Allow native callers in GetEntryGlobal. r=me (ca68cc8896)
- Bug 1248719. Fix things so that taking ownership of error reporting on an AutoJSAPI on a worker is OK even if that AutoJSAPI was initialized without an explicit global. r=bholley (b8e59eebc6)
- Bug 1156065 - Send cloneable messages from SiteSpecificUserAgent.js to fix UA overrides r=billm (e5cdbe96f6)
- Bug 1210099 - Fix structured clone of expanded principal (r=bholley) (01a5fd4e47)
- Bug 1230351: Replace ThirdPartyUtil::IsThirdPartyInternal's warning-spammy NS_ENSURE_ARG with an equivalent check that lacks the warning. r=mrbkap (037c39472c)
- Bug 1184293 - Don't call ThirdPartyUtil::GetBaseDomain if aUri is null. r=jduell (4853c0e9e0)
- Bug 862147 - instrument usage of window.sidebar.addSearchEngine, r=froydnj,smaug. (ef52ded1c0)
- Bug 1214764 - Convert NS_ENSURE to a plain return in nsDocument::IsScriptEnabled. r=bholley (0f3b6d63b4)
- Bug 1245950: Privately inherit from legacy interfaces nsIDOMWindow/nsIDOMWindowInternal. r=smaug (ff1d431d0d)
- Bug 1245950: Followup to null check before asserting. r=me CLOSED TREE (6e93af4a4a)
- Bug 1236607, pointerlock code should null check inner window before using it, r=xidorn (896d9723d5)
- Bug 1245245 - Fix typo in error string URL. r=botond (58c9548f15)
- Bug 1220604 - Remove dead code from nsGlobalWindow::SetNewDocument. r=baku (fc875db5e4)
- Bug 1247049 - Optimize GetScreenXY by using the new nsDeviceContext method to get desktop scale factor. r=emk (de66d59631)
- missing bit of Bug 962249 part 3 (0b15f8b670)
- Bug 1240978 - Shorten timeout for black screen in fullscreen transition. r=smaug (2554a8e5a7)
- Bug 1246346 - patch 1 - Expose a DesktopToDevice scale factor on nsDeviceContext. r=emk (03856ec7b4)
- Bug 1246346 - patch 2 - Correct the origin of the DOM screen coordinates (screen.left, screen.top) for secondary display on a mixed-DPI configuration. r=emk (15ac2d3be6)
- Bug 1196159 - Set nsGlobalWindow::mIsClosed properly after window.close(). r=billm (27334e4b61)
- Bug 1240241 - Don't recurse infinitely in FilterCachedColorModels::ForColorModel if the original filter node was null. r=roc (1730db5ca7)
- Bug 1247706 - "Please don't disable WebGL if crashed on WebGL context". r=dvander (e25621753e)
- Bug 1244742. Use the default copy constructor and assignment operators. (0dac3bcbfb)
- Bug 1230929 - modified the logic in order to prvent null pointer dereference. r=jmuizelaar (1d5761abc9)
- Bug 1247979. Optimize ScaleToOutsidePixels. r=kats (2b9ef41111)
- Bug 1249368 - use UniquePtr instead of nsAutoArrayPtr in gfxAlphaBoxBlur; r=jrmuizel (e60419d49d)
- Bug 1082598 - Part 4: Workaround for naming conflict in unified sources for Skia and thebes DWrite fonts. r=jrmuizel (84a9e11ded)
- Bug 1172817 - Remove PL_DHashTableEnumerate() use from FontNameCache. r=jtd. (b0632cd825)
- Bug 1197717 - Load fonts from profile-agnostic writable location. r=jfkthame (c9227268ff)
- Bug 1246889 - Correctly check whether hb_blob_create failed in ShareTableAndGetBlob. r=jfkthame (f8c62776be)
- Bug 1246834 - Fix memory reporting of nsFontFamily{List,Name}. r=jfkthame. (0535b8c110)
- Bug 1238134 P1 Provide a Response.cloneUnfiltered() method for chrome code to access internal Response state. r=ehsan (3dc25b1501)
- Bug 1238134 P2 Test chrome-only Response.cloneUnfiltered(). r=ehsan (3c307c4ec0)
- Bug 1100949 - wrap font info reads with structured exception handler. r=bas (2c2cacb05e)
- Bug 1241931 - On shutdown stop any ongoing loading of fonts; GDI in particular. r=jdaggett (057aae8cab)
- Bug 1154182 - enable native keybindings for graphene. r=billm (33e706a020)
- Bug 1167081 - Call PuppetWidget::Destroy() in its destructor. r=roc (58115c3029)
- Bug 1222662 - Disable cursor caching in the content process on Windows. r=aklotz (e760794ee2)
- Bug 1240891 - Silence warning from calling GetNativeData(NS_NATIVE_WINDOW). r=roc (d766a47f66)
- Bug 1248981 - Fix spelling error in nsMenuUtilsX.mm, a=tomcat (b93c16b961)
- Bug 1197925 - Use channel->Open2() in intl/hyphenation/hnjstdio.cpp (r=sicking) (2bf5dd3cd3)
- Bug 1248339 - fix header sort order of hal. r=gsvelto (01b61a2f5d)
- Bug 1232687: Add system-service interface to HAL, r=gsvelto (ab692e1508)
- Bug 1236762 - Simplify locking APIs for SharedSurface. - r=jrmuizel (901ae94a85)
607 lines
19 KiB
JavaScript
607 lines
19 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
var Cc = Components.classes;
|
|
var Ci = Components.interfaces;
|
|
var Cu = Components.utils;
|
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
|
Cu.import("resource://gre/modules/RemoteAddonsChild.jsm");
|
|
Cu.import("resource://gre/modules/Timer.jsm");
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "PageThumbUtils",
|
|
"resource://gre/modules/PageThumbUtils.jsm");
|
|
|
|
let FocusSyncHandler = {
|
|
init: function() {
|
|
sendAsyncMessage("SetSyncHandler", {}, {handler: this});
|
|
},
|
|
|
|
getFocusedElementAndWindow: function() {
|
|
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
|
|
|
let focusedWindow = {};
|
|
let elt = fm.getFocusedElementForWindow(content, true, focusedWindow);
|
|
return [elt, focusedWindow.value];
|
|
},
|
|
};
|
|
|
|
FocusSyncHandler.init();
|
|
|
|
var WebProgressListener = {
|
|
init: function() {
|
|
this._filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
|
|
.createInstance(Ci.nsIWebProgress);
|
|
this._filter.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_ALL);
|
|
|
|
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
.getInterface(Ci.nsIWebProgress);
|
|
webProgress.addProgressListener(this._filter, Ci.nsIWebProgress.NOTIFY_ALL);
|
|
},
|
|
|
|
uninit() {
|
|
let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
.getInterface(Ci.nsIWebProgress);
|
|
webProgress.removeProgressListener(this._filter);
|
|
|
|
this._filter.removeProgressListener(this);
|
|
this._filter = null;
|
|
},
|
|
|
|
_requestSpec: function (aRequest, aPropertyName) {
|
|
if (!aRequest || !(aRequest instanceof Ci.nsIChannel))
|
|
return null;
|
|
return aRequest.QueryInterface(Ci.nsIChannel)[aPropertyName].spec;
|
|
},
|
|
|
|
_setupJSON: function setupJSON(aWebProgress, aRequest) {
|
|
let innerWindowID = null;
|
|
if (aWebProgress) {
|
|
let domWindowID = null;
|
|
try {
|
|
let utils = aWebProgress.DOMWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
.getInterface(Ci.nsIDOMWindowUtils);
|
|
domWindowID = utils.outerWindowID;
|
|
innerWindowID = utils.currentInnerWindowID;
|
|
} catch (e) {
|
|
// If nsDocShell::Destroy has already been called, then we'll
|
|
// get NS_NOINTERFACE when trying to get the DOM window.
|
|
// If there is no current inner window, we'll get
|
|
// NS_ERROR_NOT_AVAILABLE.
|
|
}
|
|
|
|
aWebProgress = {
|
|
isTopLevel: aWebProgress.isTopLevel,
|
|
isLoadingDocument: aWebProgress.isLoadingDocument,
|
|
loadType: aWebProgress.loadType,
|
|
DOMWindowID: domWindowID
|
|
};
|
|
}
|
|
|
|
return {
|
|
webProgress: aWebProgress || null,
|
|
requestURI: this._requestSpec(aRequest, "URI"),
|
|
originalRequestURI: this._requestSpec(aRequest, "originalURI"),
|
|
documentContentType: content.document && content.document.contentType,
|
|
innerWindowID,
|
|
};
|
|
},
|
|
|
|
_setupObjects: function setupObjects(aWebProgress) {
|
|
let domWindow;
|
|
try {
|
|
domWindow = aWebProgress && aWebProgress.DOMWindow;
|
|
} catch (e) {
|
|
// If nsDocShell::Destroy has already been called, then we'll
|
|
// get NS_NOINTERFACE when trying to get the DOM window. Ignore
|
|
// that here.
|
|
domWindow = null;
|
|
}
|
|
|
|
return {
|
|
contentWindow: content,
|
|
// DOMWindow is not necessarily the content-window with subframes.
|
|
DOMWindow: domWindow
|
|
};
|
|
},
|
|
|
|
onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
|
|
let json = this._setupJSON(aWebProgress, aRequest);
|
|
let objects = this._setupObjects(aWebProgress);
|
|
|
|
json.stateFlags = aStateFlags;
|
|
json.status = aStatus;
|
|
|
|
sendAsyncMessage("Content:StateChange", json, objects);
|
|
},
|
|
|
|
onProgressChange: function onProgressChange(aWebProgress, aRequest, aCurSelf, aMaxSelf, aCurTotal, aMaxTotal) {
|
|
let json = this._setupJSON(aWebProgress, aRequest);
|
|
let objects = this._setupObjects(aWebProgress);
|
|
|
|
json.curSelf = aCurSelf;
|
|
json.maxSelf = aMaxSelf;
|
|
json.curTotal = aCurTotal;
|
|
json.maxTotal = aMaxTotal;
|
|
|
|
sendAsyncMessage("Content:ProgressChange", json, objects);
|
|
},
|
|
|
|
onProgressChange64: function onProgressChange(aWebProgress, aRequest, aCurSelf, aMaxSelf, aCurTotal, aMaxTotal) {
|
|
this.onProgressChange(aWebProgress, aRequest, aCurSelf, aMaxSelf, aCurTotal, aMaxTotal);
|
|
},
|
|
|
|
onLocationChange: function onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) {
|
|
let json = this._setupJSON(aWebProgress, aRequest);
|
|
let objects = this._setupObjects(aWebProgress);
|
|
|
|
json.location = aLocationURI ? aLocationURI.spec : "";
|
|
json.flags = aFlags;
|
|
|
|
// These properties can change even for a sub-frame navigation.
|
|
json.canGoBack = docShell.canGoBack;
|
|
json.canGoForward = docShell.canGoForward;
|
|
|
|
if (aWebProgress && aWebProgress.isTopLevel) {
|
|
json.documentURI = content.document.documentURIObject.spec;
|
|
json.title = content.document.title;
|
|
json.charset = content.document.characterSet;
|
|
json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
|
|
json.principal = content.document.nodePrincipal;
|
|
json.synthetic = content.document.mozSyntheticDocument;
|
|
|
|
if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
|
|
let uri = aLocationURI.clone();
|
|
try {
|
|
// If the current URI contains a username/password, remove it.
|
|
uri.userPass = "";
|
|
} catch (ex) { /* Ignore failures on about: URIs. */ }
|
|
CrashReporter.annotateCrashReport("URL", uri.spec);
|
|
}
|
|
}
|
|
|
|
sendAsyncMessage("Content:LocationChange", json, objects);
|
|
},
|
|
|
|
onStatusChange: function onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
|
|
let json = this._setupJSON(aWebProgress, aRequest);
|
|
let objects = this._setupObjects(aWebProgress);
|
|
|
|
json.status = aStatus;
|
|
json.message = aMessage;
|
|
|
|
sendAsyncMessage("Content:StatusChange", json, objects);
|
|
},
|
|
|
|
onSecurityChange: function onSecurityChange(aWebProgress, aRequest, aState) {
|
|
let json = this._setupJSON(aWebProgress, aRequest);
|
|
let objects = this._setupObjects(aWebProgress);
|
|
|
|
json.state = aState;
|
|
json.status = SecurityUI.getSSLStatusAsString();
|
|
|
|
sendAsyncMessage("Content:SecurityChange", json, objects);
|
|
},
|
|
|
|
onRefreshAttempted: function onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) {
|
|
return true;
|
|
},
|
|
|
|
QueryInterface: function QueryInterface(aIID) {
|
|
if (aIID.equals(Ci.nsIWebProgressListener) ||
|
|
aIID.equals(Ci.nsIWebProgressListener2) ||
|
|
aIID.equals(Ci.nsISupportsWeakReference) ||
|
|
aIID.equals(Ci.nsISupports)) {
|
|
return this;
|
|
}
|
|
|
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
|
}
|
|
};
|
|
|
|
WebProgressListener.init();
|
|
addEventListener("unload", () => {
|
|
WebProgressListener.uninit();
|
|
});
|
|
|
|
var WebNavigation = {
|
|
init: function() {
|
|
addMessageListener("WebNavigation:GoBack", this);
|
|
addMessageListener("WebNavigation:GoForward", this);
|
|
addMessageListener("WebNavigation:GotoIndex", this);
|
|
addMessageListener("WebNavigation:LoadURI", this);
|
|
addMessageListener("WebNavigation:Reload", this);
|
|
addMessageListener("WebNavigation:Stop", this);
|
|
|
|
this._webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
|
|
this._sessionHistory = this._webNavigation.sessionHistory;
|
|
|
|
// Send a CPOW for the sessionHistory object. We need to make sure
|
|
// it stays alive as long as the content script since CPOWs are
|
|
// weakly held.
|
|
let history = this._sessionHistory;
|
|
sendAsyncMessage("WebNavigation:setHistory", {}, {history: history});
|
|
},
|
|
|
|
receiveMessage: function(message) {
|
|
switch (message.name) {
|
|
case "WebNavigation:GoBack":
|
|
this.goBack();
|
|
break;
|
|
case "WebNavigation:GoForward":
|
|
this.goForward();
|
|
break;
|
|
case "WebNavigation:GotoIndex":
|
|
this.gotoIndex(message.data.index);
|
|
break;
|
|
case "WebNavigation:LoadURI":
|
|
this.loadURI(message.data.uri, message.data.flags,
|
|
message.data.referrer, message.data.referrerPolicy,
|
|
message.data.baseURI);
|
|
break;
|
|
case "WebNavigation:Reload":
|
|
this.reload(message.data.flags);
|
|
break;
|
|
case "WebNavigation:Stop":
|
|
this.stop(message.data.flags);
|
|
break;
|
|
}
|
|
},
|
|
|
|
goBack: function() {
|
|
if (this._webNavigation.canGoBack) {
|
|
this._webNavigation.goBack();
|
|
}
|
|
},
|
|
|
|
goForward: function() {
|
|
if (this._webNavigation.canGoForward)
|
|
this._webNavigation.goForward();
|
|
},
|
|
|
|
gotoIndex: function(index) {
|
|
this._webNavigation.gotoIndex(index);
|
|
},
|
|
|
|
loadURI: function(uri, flags, referrer, referrerPolicy, baseURI) {
|
|
if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
|
|
let annotation = uri;
|
|
try {
|
|
let url = Services.io.newURI(uri, null, null);
|
|
// If the current URI contains a username/password, remove it.
|
|
url.userPass = "";
|
|
annotation = url.spec;
|
|
} catch (ex) { /* Ignore failures to parse and failures
|
|
on about: URIs. */ }
|
|
CrashReporter.annotateCrashReport("URL", annotation);
|
|
}
|
|
if (referrer)
|
|
referrer = Services.io.newURI(referrer, null, null);
|
|
if (baseURI)
|
|
baseURI = Services.io.newURI(baseURI, null, null);
|
|
this._webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
|
|
null, null, baseURI);
|
|
},
|
|
|
|
reload: function(flags) {
|
|
this._webNavigation.reload(flags);
|
|
},
|
|
|
|
stop: function(flags) {
|
|
this._webNavigation.stop(flags);
|
|
}
|
|
};
|
|
|
|
WebNavigation.init();
|
|
|
|
var SecurityUI = {
|
|
getSSLStatusAsString: function() {
|
|
let status = docShell.securityUI.QueryInterface(Ci.nsISSLStatusProvider).SSLStatus;
|
|
|
|
if (status) {
|
|
let helper = Cc["@mozilla.org/network/serialization-helper;1"]
|
|
.getService(Ci.nsISerializationHelper);
|
|
|
|
status.QueryInterface(Ci.nsISerializable);
|
|
return helper.serializeToString(status);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
};
|
|
|
|
var ControllerCommands = {
|
|
init: function () {
|
|
addMessageListener("ControllerCommands:Do", this);
|
|
},
|
|
|
|
receiveMessage: function(message) {
|
|
switch(message.name) {
|
|
case "ControllerCommands:Do":
|
|
if (docShell.isCommandEnabled(message.data))
|
|
docShell.doCommand(message.data);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
ControllerCommands.init()
|
|
|
|
addEventListener("DOMTitleChanged", function (aEvent) {
|
|
let document = content.document;
|
|
switch (aEvent.type) {
|
|
case "DOMTitleChanged":
|
|
if (!aEvent.isTrusted || aEvent.target.defaultView != content)
|
|
return;
|
|
|
|
sendAsyncMessage("DOMTitleChanged", { title: document.title });
|
|
break;
|
|
}
|
|
}, false);
|
|
|
|
addEventListener("DOMWindowClose", function (aEvent) {
|
|
if (!aEvent.isTrusted)
|
|
return;
|
|
sendAsyncMessage("DOMWindowClose");
|
|
}, false);
|
|
|
|
addEventListener("ImageContentLoaded", function (aEvent) {
|
|
if (content.document instanceof Ci.nsIImageDocument) {
|
|
let req = content.document.imageRequest;
|
|
if (!req.image)
|
|
return;
|
|
sendAsyncMessage("ImageDocumentLoaded", { width: req.image.width,
|
|
height: req.image.height });
|
|
}
|
|
}, false);
|
|
|
|
const ZoomManager = {
|
|
get fullZoom() {
|
|
return this._cache.fullZoom;
|
|
},
|
|
|
|
get textZoom() {
|
|
return this._cache.textZoom;
|
|
},
|
|
|
|
set fullZoom(value) {
|
|
this._cache.fullZoom = value;
|
|
this._markupViewer.fullZoom = value;
|
|
},
|
|
|
|
set textZoom(value) {
|
|
this._cache.textZoom = value;
|
|
this._markupViewer.textZoom = value;
|
|
},
|
|
|
|
refreshFullZoom: function() {
|
|
return this._refreshZoomValue('fullZoom');
|
|
},
|
|
|
|
refreshTextZoom: function() {
|
|
return this._refreshZoomValue('textZoom');
|
|
},
|
|
|
|
/**
|
|
* Retrieves specified zoom property value from markupViewer and refreshes
|
|
* cache if needed.
|
|
* @param valueName Either 'fullZoom' or 'textZoom'.
|
|
* @returns Returns true if cached value was actually refreshed.
|
|
* @private
|
|
*/
|
|
_refreshZoomValue: function(valueName) {
|
|
let actualZoomValue = this._markupViewer[valueName];
|
|
if (actualZoomValue != this._cache[valueName]) {
|
|
this._cache[valueName] = actualZoomValue;
|
|
return true;
|
|
}
|
|
return false;
|
|
},
|
|
|
|
get _markupViewer() {
|
|
return docShell.contentViewer;
|
|
},
|
|
|
|
_cache: {
|
|
fullZoom: NaN,
|
|
textZoom: NaN
|
|
}
|
|
};
|
|
|
|
addMessageListener("FullZoom", function (aMessage) {
|
|
ZoomManager.fullZoom = aMessage.data.value;
|
|
});
|
|
|
|
addMessageListener("TextZoom", function (aMessage) {
|
|
ZoomManager.textZoom = aMessage.data.value;
|
|
});
|
|
|
|
addEventListener("FullZoomChange", function () {
|
|
if (ZoomManager.refreshFullZoom()) {
|
|
sendAsyncMessage("FullZoomChange", { value: ZoomManager.fullZoom});
|
|
}
|
|
}, false);
|
|
|
|
addEventListener("TextZoomChange", function (aEvent) {
|
|
if (ZoomManager.refreshTextZoom()) {
|
|
sendAsyncMessage("TextZoomChange", { value: ZoomManager.textZoom});
|
|
}
|
|
}, false);
|
|
|
|
addEventListener("ZoomChangeUsingMouseWheel", function () {
|
|
sendAsyncMessage("ZoomChangeUsingMouseWheel", {});
|
|
}, false);
|
|
|
|
addMessageListener("UpdateCharacterSet", function (aMessage) {
|
|
docShell.charset = aMessage.data.value;
|
|
docShell.gatherCharsetMenuTelemetry();
|
|
});
|
|
|
|
/**
|
|
* Remote thumbnail request handler for PageThumbs thumbnails.
|
|
*/
|
|
addMessageListener("Browser:Thumbnail:Request", function (aMessage) {
|
|
let snapshotWidth = aMessage.data.canvasWidth;
|
|
let snapshotHeight = aMessage.data.canvasHeight;
|
|
let canvas = PageThumbUtils.createCanvas(content, snapshotWidth, snapshotHeight);
|
|
let snapshot = PageThumbUtils.createSnapshotThumbnail(content, canvas);
|
|
|
|
snapshot.toBlob(function (aBlob) {
|
|
sendAsyncMessage("Browser:Thumbnail:Response", {
|
|
thumbnail: aBlob,
|
|
id: aMessage.data.id
|
|
});
|
|
});
|
|
});
|
|
|
|
/**
|
|
* Remote isSafeForCapture request handler for PageThumbs.
|
|
*/
|
|
addMessageListener("Browser:Thumbnail:CheckState", function (aMessage) {
|
|
let result = PageThumbUtils.shouldStoreContentThumbnail(content, docShell);
|
|
sendAsyncMessage("Browser:Thumbnail:CheckState:Response", {
|
|
result: result
|
|
});
|
|
});
|
|
|
|
// The AddonsChild needs to be rooted so that it stays alive as long as
|
|
// the tab.
|
|
var AddonsChild = RemoteAddonsChild.init(this);
|
|
addEventListener("unload", () => {
|
|
RemoteAddonsChild.uninit(AddonsChild);
|
|
});
|
|
|
|
addMessageListener("NetworkPrioritizer:AdjustPriority", (msg) => {
|
|
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
|
|
let loadGroup = webNav.QueryInterface(Ci.nsIDocumentLoader)
|
|
.loadGroup.QueryInterface(Ci.nsISupportsPriority);
|
|
loadGroup.adjustPriority(msg.data.adjustment);
|
|
});
|
|
|
|
let DOMFullscreenManager = {
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
|
Ci.nsISupportsWeakReference]),
|
|
|
|
init: function() {
|
|
Services.obs.addObserver(this, "ask-parent-to-exit-fullscreen", false);
|
|
Services.obs.addObserver(this, "ask-parent-to-rollback-fullscreen", false);
|
|
addMessageListener("DOMFullscreen:ChildrenMustExit", () => {
|
|
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
.getInterface(Ci.nsIDOMWindowUtils);
|
|
utils.exitFullscreen();
|
|
});
|
|
addEventListener("unload", () => {
|
|
Services.obs.removeObserver(this, "ask-parent-to-exit-fullscreen");
|
|
Services.obs.removeObserver(this, "ask-parent-to-rollback-fullscreen");
|
|
});
|
|
},
|
|
|
|
observe: function(aSubject, aTopic, aData) {
|
|
// Observer notifications are global, which means that these notifications
|
|
// might be coming from elements that are not actually children within this
|
|
// windows' content. We should ignore those. This will not be necessary once
|
|
// we fix bug 1053413 and stop using observer notifications for this stuff.
|
|
if (aSubject.defaultView.top !== content) {
|
|
return;
|
|
}
|
|
|
|
switch (aTopic) {
|
|
case "ask-parent-to-exit-fullscreen": {
|
|
sendAsyncMessage("DOMFullscreen:RequestExit");
|
|
break;
|
|
}
|
|
case "ask-parent-to-rollback-fullscreen": {
|
|
sendAsyncMessage("DOMFullscreen:RequestRollback");
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
};
|
|
|
|
DOMFullscreenManager.init();
|
|
|
|
var AutoCompletePopup = {
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompletePopup]),
|
|
|
|
init: function() {
|
|
// Hook up the form fill autocomplete controller.
|
|
let controller = Cc["@mozilla.org/satchel/form-fill-controller;1"]
|
|
.getService(Ci.nsIFormFillController);
|
|
|
|
controller.attachToBrowser(docShell, this.QueryInterface(Ci.nsIAutoCompletePopup));
|
|
|
|
this._input = null;
|
|
this._popupOpen = false;
|
|
|
|
addMessageListener("FormAutoComplete:HandleEnter", message => {
|
|
this.selectedIndex = message.data.selectedIndex;
|
|
|
|
let controller = Components.classes["@mozilla.org/autocomplete/controller;1"].
|
|
getService(Components.interfaces.nsIAutoCompleteController);
|
|
controller.handleEnter(message.data.isPopupSelection);
|
|
});
|
|
},
|
|
|
|
destroy: function() {
|
|
let controller = Cc["@mozilla.org/satchel/form-fill-controller;1"]
|
|
.getService(Ci.nsIFormFillController);
|
|
|
|
controller.detachFromBrowser(docShell);
|
|
},
|
|
|
|
get input () { return this._input; },
|
|
get overrideValue () { return null; },
|
|
set selectedIndex (index) { },
|
|
get selectedIndex () {
|
|
// selectedIndex getter must be synchronous because we need the
|
|
// correct value when the controller is in controller::HandleEnter.
|
|
// We can't easily just let the parent inform us the new value every
|
|
// time it changes because not every action that can change the
|
|
// selectedIndex is trivial to catch (e.g. moving the mouse over the
|
|
// list).
|
|
return sendSyncMessage("FormAutoComplete:GetSelectedIndex", {});
|
|
},
|
|
get popupOpen () {
|
|
return this._popupOpen;
|
|
},
|
|
|
|
openAutocompletePopup: function (input, element) {
|
|
this._input = input;
|
|
this._popupOpen = true;
|
|
},
|
|
|
|
closePopup: function () {
|
|
this._popupOpen = false;
|
|
sendAsyncMessage("FormAutoComplete:ClosePopup", {});
|
|
},
|
|
|
|
invalidate: function () {
|
|
},
|
|
|
|
selectBy: function(reverse, page) {
|
|
this._index = sendSyncMessage("FormAutoComplete:SelectBy", {
|
|
reverse: reverse,
|
|
page: page
|
|
});
|
|
}
|
|
}
|
|
|
|
// We may not get any responses to Browser:Init if the browser element
|
|
// is torn down too quickly.
|
|
var outerWindowID = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
.getInterface(Ci.nsIDOMWindowUtils)
|
|
.outerWindowID;
|
|
var initData = sendSyncMessage("Browser:Init", {outerWindowID: outerWindowID});
|
|
if (initData.length) {
|
|
docShell.useGlobalHistory = initData[0].useGlobalHistory;
|
|
if (initData[0].initPopup) {
|
|
setTimeout(() => AutoCompletePopup.init(), 0);
|
|
}
|
|
}
|
|
|
|
addEventListener("unload", function() {
|
|
AutoCompletePopup.destroy();
|
|
});
|