--- a/mobile/android/chrome/geckoview/ErrorPageEventHandler.js
+++ b/mobile/android/chrome/geckoview/ErrorPageEventHandler.js
@@ -40,17 +40,17 @@ var ErrorPageEventHandler = {
let uri = Services.io.newURI(errorDoc.location.href);
let sslExceptions = new SSLExceptions();
if (target == perm)
sslExceptions.addPermanentException(uri, errorDoc.defaultView);
else
sslExceptions.addTemporaryException(uri, errorDoc.defaultView);
} catch (e) {
- dump("Failed to set cert exception: " + e + "\n");
+ warn `Failed to set cert exception: ${e}`;
}
errorDoc.location.reload();
} else if (target == errorDoc.getElementById("getMeOutOfHereButton")) {
errorDoc.location = "about:home";
}
}
break;
}
--- a/mobile/android/chrome/geckoview/GeckoViewContent.js
+++ b/mobile/android/chrome/geckoview/GeckoViewContent.js
@@ -5,27 +5,19 @@
ChromeUtils.import("resource://gre/modules/GeckoViewContentModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
Services: "resource://gre/modules/Services.jsm",
});
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewContent"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
class GeckoViewContent extends GeckoViewContentModule {
register() {
- debug("register");
+ debug `register`;
addEventListener("DOMTitleChanged", this, false);
addEventListener("DOMWindowFocus", this, false);
addEventListener("DOMWindowClose", this, false);
addEventListener("MozDOMFullscreen:Entered", this, false);
addEventListener("MozDOMFullscreen:Exit", this, false);
addEventListener("MozDOMFullscreen:Exited", this, false);
addEventListener("MozDOMFullscreen:Request", this, false);
@@ -35,17 +27,17 @@ class GeckoViewContent extends GeckoView
this);
this.messageManager.addMessageListener("GeckoView:DOMFullscreenExited",
this);
this.messageManager.addMessageListener("GeckoView:ZoomToInput",
this);
}
unregister() {
- debug("unregister");
+ debug `unregister`;
removeEventListener("DOMTitleChanged", this);
removeEventListener("DOMWindowFocus", this);
removeEventListener("DOMWindowClose", this);
removeEventListener("MozDOMFullscreen:Entered", this);
removeEventListener("MozDOMFullscreen:Exit", this);
removeEventListener("MozDOMFullscreen:Exited", this);
removeEventListener("MozDOMFullscreen:Request", this);
@@ -55,17 +47,17 @@ class GeckoViewContent extends GeckoView
this);
this.messageManager.removeMessageListener("GeckoView:DOMFullscreenExited",
this);
this.messageManager.removeMessageListener("GeckoView:ZoomToInput",
this);
}
receiveMessage(aMsg) {
- debug("receiveMessage " + aMsg.name);
+ debug `receiveMessage: ${aMsg.name}`;
switch (aMsg.name) {
case "GeckoView:DOMFullscreenEntered":
if (content) {
content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.handleFullscreenRequests();
}
@@ -120,17 +112,17 @@ class GeckoViewContent extends GeckoView
}
}, 500);
}
break;
}
}
handleEvent(aEvent) {
- debug("handleEvent " + aEvent.type);
+ debug `handleEvent: ${aEvent.type}`;
switch (aEvent.type) {
case "contextmenu":
function nearestParentHref(node) {
while (node && !node.href) {
node = node.parentNode;
}
return node && node.href;
--- a/mobile/android/chrome/geckoview/GeckoViewContentSettings.js
+++ b/mobile/android/chrome/geckoview/GeckoViewContentSettings.js
@@ -1,36 +1,27 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
ChromeUtils.import("resource://gre/modules/GeckoViewContentModule.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewSettings[C]"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
// Handles GeckoView content settings including:
// * tracking protection
// * desktop mode
class GeckoViewContentSettings extends GeckoViewContentModule {
init() {
- debug("init");
+ debug `init`;
this._useTrackingProtection = false;
this._useDesktopMode = false;
}
onSettingsUpdate() {
- debug("onSettingsUpdate");
+ debug `onSettingsUpdate`;
this.useTrackingProtection = !!this.settings.useTrackingProtection;
this.useDesktopMode = !!this.settings.useDesktopMode;
}
get useTrackingProtection() {
return this._useTrackingProtection;
}
--- a/mobile/android/chrome/geckoview/GeckoViewNavigationContent.js
+++ b/mobile/android/chrome/geckoview/GeckoViewNavigationContent.js
@@ -6,41 +6,35 @@
ChromeUtils.import("resource://gre/modules/GeckoViewContentModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
ErrorPageEventHandler: "chrome://geckoview/content/ErrorPageEventHandler.js",
LoadURIDelegate: "resource://gre/modules/LoadURIDelegate.jsm",
});
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewNavigation[C]"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
// Implements nsILoadURIDelegate.
class GeckoViewNavigationContent extends GeckoViewContentModule {
register() {
- debug("register");
+ debug `register`;
docShell.loadURIDelegate = this;
}
unregister() {
- debug("unregister");
+ debug `unregister`;
docShell.loadURIDelegate = null;
}
// nsILoadURIDelegate.
loadURI(aUri, aWhere, aFlags, aTriggeringPrincipal) {
- debug("loadURI " + (aUri && aUri.spec) + " " + aWhere + " " + aFlags);
+ debug `loadURI: uri=${ aUri && aUri.spec
+ } where=${ aWhere
+ } flags=${ aFlags }`;
// TODO: Remove this when we have a sensible error API.
if (aUri && aUri.displaySpec.startsWith("about:certerror")) {
addEventListener("click", ErrorPageEventHandler, true);
}
return LoadURIDelegate.load(this.eventDispatcher, aUri, aWhere, aFlags,
aTriggeringPrincipal);
--- a/mobile/android/chrome/geckoview/GeckoViewScrollContent.js
+++ b/mobile/android/chrome/geckoview/GeckoViewScrollContent.js
@@ -1,41 +1,32 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
ChromeUtils.import("resource://gre/modules/GeckoViewContentModule.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewScrollContent"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
class GeckoViewScrollContent extends GeckoViewContentModule {
register() {
- debug("register");
+ debug `register`;
addEventListener("scroll", this, false);
}
unregister() {
- debug("unregister");
+ debug `unregister`;
removeEventListener("scroll", this);
}
handleEvent(aEvent) {
if (aEvent.originalTarget.defaultView != content) {
return;
}
- debug("handleEvent " + aEvent.type);
+ debug `handleEvent: ${aEvent.type}`;
switch (aEvent.type) {
case "scroll":
this.eventDispatcher.sendRequest({
type: "GeckoView:ScrollChanged",
scrollX: Math.round(content.scrollX),
scrollY: Math.round(content.scrollY)
});
--- a/mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js
+++ b/mobile/android/chrome/geckoview/GeckoViewSelectionActionContent.js
@@ -5,24 +5,16 @@
ChromeUtils.import("resource://gre/modules/GeckoViewContentModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
Services: "resource://gre/modules/Services.jsm",
});
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewSelectionActionContent"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
// Dispatches GeckoView:ShowSelectionAction and GeckoView:HideSelectionAction to
// the GeckoSession on accessible caret changes.
class GeckoViewSelectionActionContent extends GeckoViewContentModule {
constructor(aModuleName, aMessageManager) {
super(aModuleName, aMessageManager);
this._seqNo = 0;
this._isActive = false;
@@ -124,22 +116,22 @@ class GeckoViewSelectionActionContent ex
break;
}
}
return offset;
}
register() {
- debug("register");
+ debug `register`;
addEventListener("mozcaretstatechanged", this, { mozSystemGroup: true });
}
unregister() {
- debug("unregister");
+ debug `unregister`;
removeEventListener("mozcaretstatechanged", this, { mozSystemGroup: true });
}
/**
* Receive and act on AccessibleCarets caret state-change
* (mozcaretstatechanged) events.
*/
handleEvent(aEvent) {
@@ -156,17 +148,17 @@ class GeckoViewSelectionActionContent ex
reason !== "longpressonemptycontent" &&
reason !== "taponcaret") {
// Don't show selection actions when merely focusing on an editor or
// repositioning the cursor. Wait until long press or the caret is tapped
// in order to match Android behavior.
reason = "visibilitychange";
}
- debug("handleEvent " + reason + " " + aEvent);
+ debug `handleEvent: ${reason}`;
if (["longpressonemptycontent",
"releasecaret",
"taponcaret",
"updateposition"].includes(reason)) {
const actions = this._actions.filter(
action => action.predicate.call(this, aEvent));
@@ -202,31 +194,29 @@ class GeckoViewSelectionActionContent ex
// Don't call again if we're already active and things haven't changed.
return;
}
msg.seqNo = ++this._seqNo;
this._isActive = true;
this._previousMessage = JSON.stringify(msg);
- debug("onShowSelectionAction " + JSON.stringify(msg));
-
// This event goes to GeckoViewSelectionAction.jsm, where the data is
// further transformed and then sent to GeckoSession.
this.eventDispatcher.sendRequest(msg, {
onSuccess: response => {
if (response.seqNo !== this._seqNo) {
// Stale action.
return;
}
let action = actions.find(action => action.id === response.id);
if (action) {
action.perform.call(this, aEvent, response);
} else {
- dump("Invalid action " + response.id);
+ warn `Invalid action ${response.id}`;
}
},
onError: _ => {
// Do nothing; we can get here if the delegate was just unregistered.
},
});
} else if (["invisibleselection",
@@ -248,15 +238,15 @@ class GeckoViewSelectionActionContent ex
}
this.eventDispatcher.sendRequest({
type: "GeckoView:HideSelectionAction",
reason: reason,
});
} else {
- dump("Unknown reason: " + reason);
+ warn `Unknown reason: ${reason}`;
}
}
}
var {module, debug, warn} =
GeckoViewSelectionActionContent.create("GeckoViewSelectionAction", this);
--- a/mobile/android/chrome/geckoview/geckoview.js
+++ b/mobile/android/chrome/geckoview/geckoview.js
@@ -10,20 +10,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
EventDispatcher: "resource://gre/modules/Messaging.jsm",
GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
Services: "resource://gre/modules/Services.jsm",
});
XPCOMUtils.defineLazyGetter(this, "WindowEventDispatcher",
() => EventDispatcher.for(window));
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "View"));
-
// Creates and manages GeckoView modules.
// A module must extend GeckoViewModule.
// Instantiate a module by calling
// add(<resource path>, <type name>)
// and remove by calling
// remove(<type name>)
var ModuleManager = {
init: function(aBrowser) {
--- a/mobile/android/components/geckoview/GeckoViewExternalAppService.js
+++ b/mobile/android/components/geckoview/GeckoViewExternalAppService.js
@@ -7,52 +7,46 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
GeckoViewUtils.initLogging("GeckoViewExternalAppService", this);
ChromeUtils.defineModuleGetter(this, "EventDispatcher",
"resource://gre/modules/Messaging.jsm");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewContent"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
function ExternalAppService() {
this.wrappedJSObject = this;
}
ExternalAppService.prototype = {
classID: Components.ID("{a89eeec6-6608-42ee-a4f8-04d425992f45}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIExternalHelperAppService]),
doContent(mimeType, request, context, forceSave) {
const channel = request.QueryInterface(Ci.nsIChannel);
const mm = context.QueryInterface(Ci.nsIDocShell).tabChild.messageManager;
- debug(`doContent() URI=${channel.URI.displaySpec}, contentType=${channel.contentType}`);
+ debug `doContent: uri=${ channel.URI.displaySpec
+ } contentType=${ channel.contentType }`;
EventDispatcher.forMessageManager(mm).sendRequest({
type: "GeckoView:ExternalResponse",
uri: channel.URI.displaySpec,
contentType: channel.contentType,
contentLength: channel.contentLength,
filename: channel.contentDispositionFilename
});
request.cancel(Cr.NS_ERROR_ABORT);
Components.returnCode = Cr.NS_ERROR_ABORT;
},
applyDecodingForExtension(ext, encoding) {
- debug(`applyDecodingForExtension() extension=${ext}, encoding=${encoding}`);
+ debug `applyDecodingForExtension: extension=${ ext
+ } encoding=${ encoding }`;
// This doesn't matter for us right now because
// we shouldn't end up reading the stream.
return true;
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ExternalAppService]);
--- a/mobile/android/modules/geckoview/GeckoViewContent.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewContent.jsm
@@ -4,24 +4,16 @@
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewContent"];
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewContent"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
class GeckoViewContent extends GeckoViewModule {
init() {
this.eventDispatcher.registerListener(this, [
"GeckoView:SetActive"
]);
}
register() {
@@ -38,17 +30,18 @@ class GeckoViewContent extends GeckoView
]);
this.messageManager.addMessageListener("GeckoView:DOMFullscreenExit", this);
this.messageManager.addMessageListener("GeckoView:DOMFullscreenRequest", this);
}
// Bundle event handler.
onEvent(aEvent, aData, aCallback) {
- debug("onEvent: " + aEvent);
+ debug `onEvent: event=${aEvent}, data=${aData}`;
+
switch (aEvent) {
case "GeckoViewContent:ExitFullScreen":
this.messageManager.sendAsyncMessage("GeckoView:DOMFullscreenExited");
break;
case "GeckoView:ZoomToInput":
this.messageManager.sendAsyncMessage(aEvent);
break;
case "GeckoView:SetActive":
@@ -72,34 +65,34 @@ class GeckoViewContent extends GeckoView
/* capture */ true);
this.messageManager.removeMessageListener("GeckoView:DOMFullscreenExit", this);
this.messageManager.removeMessageListener("GeckoView:DOMFullscreenRequest", this);
}
// DOM event handler
handleEvent(aEvent) {
- debug("handleEvent: aEvent.type=" + aEvent.type);
+ debug `handleEvent: ${aEvent.type}`;
switch (aEvent.type) {
case "MozDOMFullscreen:Entered":
if (this.browser == aEvent.target) {
// Remote browser; dispatch to content process.
this.messageManager.sendAsyncMessage("GeckoView:DOMFullscreenEntered");
}
break;
case "MozDOMFullscreen:Exited":
this.messageManager.sendAsyncMessage("GeckoView:DOMFullscreenExited");
break;
}
}
// Message manager event handler.
receiveMessage(aMsg) {
- debug("receiveMessage " + aMsg.name);
+ debug `receiveMessage: ${aMsg.name}`;
switch (aMsg.name) {
case "GeckoView:DOMFullscreenExit":
this.window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.remoteFrameFullscreenReverted();
break;
case "GeckoView:DOMFullscreenRequest":
--- a/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
@@ -9,24 +9,16 @@ var EXPORTED_SYMBOLS = ["GeckoViewConten
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
GeckoViewUtils.initLogging("GeckoViewContentModule", this);
ChromeUtils.defineModuleGetter(this, "EventDispatcher",
"resource://gre/modules/Messaging.jsm");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewContentModule"));
-
-// function debug(aMsg) {
-// dump(aMsg);
-// }
-
class GeckoViewContentModule {
static create(aModuleName, aGlobal) {
let scope = {
module: new this(aModuleName, aGlobal),
};
GeckoViewUtils.initLogging(aModuleName + "[C]", scope);
return scope;
}
--- a/mobile/android/modules/geckoview/GeckoViewModule.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewModule.jsm
@@ -6,24 +6,16 @@
var EXPORTED_SYMBOLS = ["GeckoViewModule"];
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
GeckoViewUtils.initLogging("GeckoViewModule", this);
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewModule"));
-
-// function debug(aMsg) {
-// dump(aMsg);
-// }
-
class GeckoViewModule {
constructor(aModuleName, aWindow, aBrowser, aEventDispatcher) {
this.isRegistered = false;
this.window = aWindow;
this.browser = aBrowser;
this.eventDispatcher = aEventDispatcher;
this.moduleName = aModuleName;
this._isContentLoaded = false;
@@ -127,49 +119,49 @@ class EventProxy {
this.listener = aListener;
this.eventDispatcher = aEventDispatcher;
this._eventQueue = [];
this._registeredEvents = [];
this._enableQueuing = false;
}
registerListener(aEventList) {
- debug("register " + aEventList);
+ debug `registerListener ${aEventList}`;
this.eventDispatcher.registerListener(this, aEventList);
this._registeredEvents = this._registeredEvents.concat(aEventList);
}
unregisterListener() {
- debug("unregister");
+ debug `unregisterListener`;
if (this._registeredEvents.length === 0) {
return;
}
this.eventDispatcher.unregisterListener(this, this._registeredEvents);
this._registeredEvents = [];
}
onEvent(aEvent, aData, aCallback) {
if (this._enableQueuing) {
- debug("queue " + aEvent + ", aData=" + JSON.stringify(aData));
+ debug `queue ${aEvent}, data=${aData}`;
this._eventQueue.unshift(arguments);
} else {
this._dispatch.apply(this, arguments);
}
}
enableQueuing(aEnable) {
- debug("enableQueuing " + aEnable);
+ debug `enableQueuing ${aEnable}`;
this._enableQueuing = aEnable;
}
_dispatch(aEvent, aData, aCallback) {
- debug("dispatch " + aEvent + ", aData=" + JSON.stringify(aData));
+ debug `dispatch ${aEvent}, data=${aData}`;
this.listener.onEvent.apply(this.listener, arguments);
}
dispatchQueuedEvents() {
- debug("dispatchQueued");
+ debug `dispatchQueued`;
while (this._eventQueue.length) {
const e = this._eventQueue.pop();
this._dispatch.apply(this, e);
}
}
}
--- a/mobile/android/modules/geckoview/GeckoViewNavigation.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewNavigation.jsm
@@ -10,24 +10,16 @@ ChromeUtils.import("resource://gre/modul
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
EventDispatcher: "resource://gre/modules/Messaging.jsm",
LoadURIDelegate: "resource://gre/modules/LoadURIDelegate.jsm",
Services: "resource://gre/modules/Services.jsm",
});
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewNavigation"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
// Handles navigation requests between Gecko and a GeckoView.
// Handles GeckoView:GoBack and :GoForward requests dispatched by
// GeckoView.goBack and .goForward.
// Dispatches GeckoView:LocationChange to the GeckoView on location change when
// active.
// Implements nsIBrowserDOMWindow.
class GeckoViewNavigation extends GeckoViewModule {
init() {
@@ -39,17 +31,17 @@ class GeckoViewNavigation extends GeckoV
"GeckoView:LoadUri",
"GeckoView:Reload",
"GeckoView:Stop"
]);
}
// Bundle event handler.
onEvent(aEvent, aData, aCallback) {
- debug("onEvent: aEvent=" + aEvent + ", aData=" + JSON.stringify(aData));
+ debug `onEvent: event=${aEvent}, data=${aData}`;
switch (aEvent) {
case "GeckoView:GoBack":
this.browser.goBack();
break;
case "GeckoView:GoForward":
this.browser.goForward();
break;
@@ -86,17 +78,17 @@ class GeckoViewNavigation extends GeckoV
case "GeckoView:Stop":
this.browser.stop();
break;
}
}
// Message manager event handler.
receiveMessage(aMsg) {
- debug("receiveMessage " + aMsg.name);
+ debug `receiveMessage: ${aMsg.name}`;
}
waitAndSetOpener(aSessionId, aOpener) {
if (!aSessionId) {
return Promise.resolve(null);
}
return new Promise(resolve => {
@@ -113,19 +105,19 @@ class GeckoViewNavigation extends GeckoV
};
// This event is emitted from createBrowser() in geckoview.js
Services.obs.addObserver(handler, "geckoview-window-created");
});
}
handleNewSession(aUri, aOpener, aWhere, aFlags, aTriggeringPrincipal) {
- debug("handleNewSession: aUri=" + (aUri && aUri.spec) +
- " aWhere=" + aWhere +
- " aFlags=" + aFlags);
+ debug `handleNewSession: uri=${ aUri && aUri.spec
+ } where=${ aWhere
+ } flags=${ aFlags }`;
if (!this.isRegistered) {
return null;
}
const message = {
type: "GeckoView:OnNewSession",
uri: aUri ? aUri.displaySpec : ""
@@ -143,19 +135,19 @@ class GeckoViewNavigation extends GeckoV
// Wait indefinitely for app to respond with a browser or null
Services.tm.spinEventLoopUntil(() => browser !== undefined);
return browser;
}
// nsIBrowserDOMWindow.
createContentWindow(aUri, aOpener, aWhere, aFlags, aTriggeringPrincipal) {
- debug("createContentWindow: aUri=" + (aUri && aUri.spec) +
- " aWhere=" + aWhere +
- " aFlags=" + aFlags);
+ debug `createContentWindow: uri=${ aUri && aUri.spec
+ } where=${ aWhere
+ } flags=${ aFlags }`;
if (LoadURIDelegate.load(this.eventDispatcher, aUri, aWhere, aFlags,
aTriggeringPrincipal)) {
// The app has handled the load, abort open-window handling.
Components.returnCode = Cr.NS_ERROR_ABORT;
return null;
}
@@ -167,22 +159,22 @@ class GeckoViewNavigation extends GeckoV
}
return browser.contentWindow;
}
// nsIBrowserDOMWindow.
createContentWindowInFrame(aUri, aParams, aWhere, aFlags, aNextTabParentId,
aName) {
- debug("createContentWindowInFrame: aUri=" + (aUri && aUri.spec) +
- " aParams=" + aParams +
- " aWhere=" + aWhere +
- " aFlags=" + aFlags +
- " aNextTabParentId=" + aNextTabParentId +
- " aName=" + aName);
+ debug `createContentWindowInFrame: uri=${ aUri && aUri.spec
+ } params=${ aParams
+ } where=${ aWhere
+ } flags=${ aFlags
+ } nextTabParentId=${ aNextTabParentId
+ } name=${ aName }`;
if (LoadURIDelegate.load(this.eventDispatcher, aUri, aWhere, aFlags, null)) {
// The app has handled the load, abort open-window handling.
Components.returnCode = Cr.NS_ERROR_ABORT;
return null;
}
const browser = this.handleNewSession(aUri, null, aWhere, aFlags, null);
@@ -192,19 +184,19 @@ class GeckoViewNavigation extends GeckoV
}
browser.setAttribute("nextTabParentId", aNextTabParentId);
return browser;
}
handleOpenUri(aUri, aOpener, aWhere, aFlags, aTriggeringPrincipal,
aNextTabParentId) {
- debug("handleOpenUri: aUri=" + (aUri && aUri.spec) +
- " aWhere=" + aWhere +
- " aFlags=" + aFlags);
+ debug `handleOpenUri: uri=${ aUri && aUri.spec
+ } where=${ aWhere
+ } flags=${ aFlags }`;
if (LoadURIDelegate.load(this.eventDispatcher, aUri, aWhere, aFlags,
aTriggeringPrincipal)) {
return null;
}
let browser = this.browser;
@@ -239,59 +231,57 @@ class GeckoViewNavigation extends GeckoV
// nsIBrowserDOMWindow.
isTabContentWindow(aWindow) {
return this.browser.contentWindow === aWindow;
}
// nsIBrowserDOMWindow.
canClose() {
- debug("canClose");
+ debug `canClose`;
return false;
}
register() {
- debug("register");
+ debug `register`;
this.registerContent(
"chrome://geckoview/content/GeckoViewNavigationContent.js");
let flags = Ci.nsIWebProgress.NOTIFY_LOCATION;
this.progressFilter =
Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
.createInstance(Ci.nsIWebProgress);
this.progressFilter.addProgressListener(this, flags);
this.browser.addProgressListener(this.progressFilter, flags);
}
unregister() {
- debug("unregister");
+ debug `unregister`;
if (!this.progressFilter) {
return;
}
this.progressFilter.removeProgressListener(this);
this.browser.removeProgressListener(this.progressFilter);
}
// WebProgress event handler.
onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) {
- debug("onLocationChange");
+ debug `onLocationChange`;
let fixedURI = aLocationURI;
try {
fixedURI = Services.uriFixup.createExposableURI(aLocationURI);
} catch (ex) { }
let message = {
type: "GeckoView:LocationChange",
uri: fixedURI.displaySpec,
canGoBack: this.browser.canGoBack,
canGoForward: this.browser.canGoForward,
isTopLevel: aWebProgress.isTopLevel,
};
- debug("dispatch " + JSON.stringify(message));
-
this.eventDispatcher.sendRequest(message);
}
}
--- a/mobile/android/modules/geckoview/GeckoViewProgress.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewProgress.jsm
@@ -11,24 +11,16 @@ ChromeUtils.import("resource://gre/modul
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "OverrideService",
"@mozilla.org/security/certoverride;1", "nsICertOverrideService");
XPCOMUtils.defineLazyServiceGetter(this, "IDNService",
"@mozilla.org/network/idn-service;1", "nsIIDNService");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewProgress"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
var IdentityHandler = {
// The definitions below should be kept in sync with those in GeckoView.ProgressListener.SecurityInformation
// No trusted identity information. No site identity icon is shown.
IDENTITY_MODE_UNKNOWN: 0,
// Domain-Validation SSL CA-signed domain verification (DV).
IDENTITY_MODE_IDENTIFIED: 1,
@@ -187,54 +179,56 @@ var IdentityHandler = {
};
class GeckoViewProgress extends GeckoViewModule {
init() {
this._hostChanged = false;
}
register() {
- debug("register");
+ debug `register`;
let flags = Ci.nsIWebProgress.NOTIFY_STATE_NETWORK |
Ci.nsIWebProgress.NOTIFY_SECURITY |
Ci.nsIWebProgress.NOTIFY_LOCATION;
this.progressFilter =
Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
.createInstance(Ci.nsIWebProgress);
this.progressFilter.addProgressListener(this, flags);
this.browser.addProgressListener(this.progressFilter, flags);
}
unregister() {
- debug("unregister");
+ debug `unregister`;
if (this.progressFilter) {
this.progressFilter.removeProgressListener(this);
this.browser.removeProgressListener(this.progressFilter);
}
}
onSettingsUpdate() {
- let settings = this.settings;
- debug("onSettingsUpdate: " + JSON.stringify(settings));
+ const settings = this.settings;
+ debug `onSettingsUpdate: ${settings}`;
IdentityHandler.setUseTrackingProtection(!!settings.useTrackingProtection);
IdentityHandler.setUsePrivateMode(!!settings.usePrivateMode);
}
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
- debug(`onStateChange() isTopLevel=${aWebProgress.isTopLevel}, stateFlags=${aStateFlags}, state=${aStatus}`);
+ debug `onStateChange: isTopLevel=${ aWebProgress.isTopLevel
+ }, flags=${ aStateFlags
+ }, status=${ aStatus }`;
if (!aWebProgress.isTopLevel) {
return;
}
const uriSpec = aRequest.QueryInterface(Ci.nsIChannel).URI.displaySpec;
- debug(`onStateChange() URI=${uriSpec}`);
+ debug `onStateChange: uri=${uriSpec}`;
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
const message = {
type: "GeckoView:PageStart",
uri: uriSpec,
};
this.eventDispatcher.sendRequest(message);
@@ -245,17 +239,17 @@ class GeckoViewProgress extends GeckoVie
success: !aStatus
};
this.eventDispatcher.sendRequest(message);
}
}
onSecurityChange(aWebProgress, aRequest, aState) {
- debug("onSecurityChange()");
+ debug `onSecurityChange`;
// Don't need to do anything if the data we use to update the UI hasn't changed
if (this._state === aState && !this._hostChanged) {
return;
}
this._state = aState;
this._hostChanged = false;
@@ -266,17 +260,18 @@ class GeckoViewProgress extends GeckoVie
type: "GeckoView:SecurityChanged",
identity: identity
};
this.eventDispatcher.sendRequest(message);
}
onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) {
- debug(`onLocationChange() location=${aLocationURI.displaySpec}, flags=${aFlags}`);
+ debug `onLocationChange: location=${ aLocationURI.displaySpec
+ }, flags=${ aFlags }`;
this._hostChanged = true;
if (aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) {
// We apparently don't get a STATE_STOP in onStateChange(), so emit PageStop here
this.eventDispatcher.sendRequest({
type: "GeckoView:PageStop",
success: false
});
--- a/mobile/android/modules/geckoview/GeckoViewRemoteDebugger.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewRemoteDebugger.jsm
@@ -5,30 +5,22 @@
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewRemoteDebugger"];
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm", {})
- .AndroidLog.d.bind(null, "ViewRemoteDebugger"));
-
XPCOMUtils.defineLazyGetter(this, "DebuggerServer", () => {
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const { DebuggerServer } = require("devtools/server/main");
return DebuggerServer;
});
-function debug(aMsg) {
- // dump(aMsg);
-}
-
class GeckoViewRemoteDebugger extends GeckoViewModule {
init() {
this._isEnabled = false;
this._usbDebugger = new USBRemoteDebugger();
}
onSettingsUpdate() {
let enabled = this.settings.useRemoteDebugger;
@@ -50,17 +42,17 @@ class GeckoViewRemoteDebugger extends Ge
let windowId = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
let env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
let dataDir = env.get("MOZ_ANDROID_DATA_DIR");
if (!dataDir) {
- debug("Missing env MOZ_ANDROID_DATA_DIR - aborting debugger server start");
+ warn `Missing env MOZ_ANDROID_DATA_DIR - aborting debugger server start`;
return;
}
this._isEnabled = true;
this._usbDebugger.stop();
let portOrPath = dataDir + "/firefox-debugger-socket-" + windowId;
this._usbDebugger.start(portOrPath);
@@ -77,32 +69,32 @@ class USBRemoteDebugger {
try {
let AuthenticatorType = DebuggerServer.Authenticators.get("PROMPT");
let authenticator = new AuthenticatorType.Server();
authenticator.allowConnection = this.allowConnection.bind(this);
this._listener = DebuggerServer.createListener();
this._listener.portOrPath = aPortOrPath;
this._listener.authenticator = authenticator;
this._listener.open();
- debug(`USB remote debugger - listening on ${aPortOrPath}`);
+ debug `USB remote debugger - listening on ${aPortOrPath}`;
} catch (e) {
- debug("Unable to start USB debugger server: " + e);
+ warn `Unable to start USB debugger server: ${e}`;
}
}
stop() {
if (!this._listener) {
return;
}
try {
this._listener.close();
this._listener = null;
} catch (e) {
- debug("Unable to stop USB debugger server: " + e);
+ warn `Unable to stop USB debugger server: ${e}`;
}
}
allowConnection(aSession) {
if (!this._listener) {
return DebuggerServer.AuthenticationResult.DENY;
}
--- a/mobile/android/modules/geckoview/GeckoViewScroll.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewScroll.jsm
@@ -4,27 +4,15 @@
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewScroll"];
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewScroll"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
class GeckoViewScroll extends GeckoViewModule {
- init() {
- debug("init");
- }
-
register() {
- debug("register");
+ debug `register`;
this.registerContent("chrome://geckoview/content/GeckoViewScrollContent.js");
}
}
--- a/mobile/android/modules/geckoview/GeckoViewSelectionAction.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewSelectionAction.jsm
@@ -4,35 +4,15 @@
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewSelectionAction"];
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewSelectionAction"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
// Handles inter-op between accessible carets and GeckoSession.
class GeckoViewSelectionAction extends GeckoViewModule {
- init() {
- }
-
register() {
- debug("register");
+ debug `register`;
this.registerContent("chrome://geckoview/content/GeckoViewSelectionActionContent.js");
}
-
- unregister() {
- debug("unregister");
- }
-
- // Message manager event handler.
- receiveMessage(aMsg) {
- debug("receiveMessage " + aMsg.name);
- }
}
--- a/mobile/android/modules/geckoview/GeckoViewSettings.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewSettings.jsm
@@ -18,24 +18,16 @@ XPCOMUtils.defineLazyGetter(
this, "DESKTOP_USER_AGENT",
function() {
return Cc["@mozilla.org/network/protocol;1?name=http"]
.getService(Ci.nsIHttpProtocolHandler).userAgent
.replace(/Android \d.+?; [a-zA-Z]+/, "X11; Linux x86_64")
.replace(/Gecko\/[0-9\.]+/, "Gecko/20100101");
});
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewSettings"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
// Handles GeckoView settings including:
// * multiprocess
// * user agent override
class GeckoViewSettings extends GeckoViewModule {
init() {
this._isSafeBrowsingInit = false;
this._useDesktopMode = false;
@@ -44,21 +36,22 @@ class GeckoViewSettings extends GeckoVie
this.useMultiprocess = !!this.settings.useMultiprocess;
this._displayMode = Ci.nsIDocShell.DISPLAY_MODE_BROWSER;
this.messageManager.loadFrameScript(
"chrome://geckoview/content/GeckoViewContentSettings.js", true);
}
onSettingsUpdate() {
- debug("onSettingsUpdate: " + JSON.stringify(this.settings));
+ const settings = this.settings;
+ debug `onSettingsUpdate: ${settings}`;
- this.displayMode = this.settings.displayMode;
- this.useTrackingProtection = !!this.settings.useTrackingProtection;
- this.useDesktopMode = !!this.settings.useDesktopMode;
+ this.displayMode = settings.displayMode;
+ this.useTrackingProtection = !!settings.useTrackingProtection;
+ this.useDesktopMode = !!settings.useDesktopMode;
}
get useMultiprocess() {
return this.browser.getAttribute("remote") == "true";
}
set useMultiprocess(aUse) {
if (aUse == this.useMultiprocess) {
@@ -78,17 +71,17 @@ class GeckoViewSettings extends GeckoVie
set useTrackingProtection(aUse) {
if (aUse && !this._isSafeBrowsingInit) {
SafeBrowsing.init();
this._isSafeBrowsingInit = true;
}
}
onUserAgentRequest(aSubject, aTopic, aData) {
- debug("onUserAgentRequest");
+ debug `onUserAgentRequest`;
let channel = aSubject.QueryInterface(Ci.nsIHttpChannel);
if (this.browser.outerWindowID !== channel.topLevelOuterContentWindowId) {
return;
}
if (this.useDesktopMode) {
--- a/mobile/android/modules/geckoview/GeckoViewTab.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewTab.jsm
@@ -4,24 +4,16 @@
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewTab"];
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewTab"));
-
-// function debug(aMsg) {
-// dump(aMsg);
-// }
-
// Stub BrowserApp implementation for WebExtensions support.
class GeckoViewTab extends GeckoViewModule {
init() {
this.browser.tab = { id: 0, browser: this.browser };
this.window.gBrowser = this.window.BrowserApp = {
selectedBrowser: this.browser,
tabs: [this.browser.tab],
--- a/mobile/android/modules/geckoview/GeckoViewTrackingProtection.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewTrackingProtection.jsm
@@ -4,42 +4,30 @@
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewTrackingProtection"];
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyGetter(this, "dump", () =>
- ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
- {}).AndroidLog.d.bind(null, "ViewTrackingProtection"));
-
-function debug(aMsg) {
- // dump(aMsg);
-}
-
class GeckoViewTrackingProtection extends GeckoViewModule {
- init() {
- debug("init");
- }
-
register() {
- debug("register");
+ debug `register`;
const flags = Ci.nsIWebProgress.NOTIFY_SECURITY;
this.progressFilter =
Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
.createInstance(Ci.nsIWebProgress);
this.progressFilter.addProgressListener(this, flags);
this.browser.addProgressListener(this.progressFilter, flags);
}
onSecurityChange(aWebProgress, aRequest, aState) {
- debug("onSecurityChange");
+ debug `onSecurityChange`;
if (!(aState & Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT) ||
!aRequest || !(aRequest instanceof Ci.nsIClassifiedChannel)) {
return;
}
let channel = aRequest.QueryInterface(Ci.nsIChannel);
let uri = channel.URI && channel.URI.spec;