--- a/mobile/android/chrome/geckoview/geckoview.js
+++ b/mobile/android/chrome/geckoview/geckoview.js
@@ -57,15 +57,15 @@ function startup() {
ModuleManager.add("resource://gre/modules/GeckoViewSettings.jsm",
"GeckoViewSettings");
ModuleManager.add("resource://gre/modules/GeckoViewContent.jsm",
"GeckoViewContent");
ModuleManager.add("resource://gre/modules/GeckoViewProgress.jsm",
"GeckoViewProgress");
ModuleManager.add("resource://gre/modules/GeckoViewScroll.jsm",
"GeckoViewScroll");
+ ModuleManager.add("resource://gre/modules/GeckoViewTab.jsm",
+ "GeckoViewTab");
// Move focus to the content window at the end of startup,
// so things like text selection can work properly.
document.getElementById("content").focus();
- ModuleManager.add("resource://gre/modules/GeckoViewTab.jsm",
- "GeckoViewTab");
}
--- a/mobile/android/chrome/jar.mn
+++ b/mobile/android/chrome/jar.mn
@@ -26,29 +26,24 @@ chrome.jar:
content/browser.xul (content/browser.xul)
content/browser.css (content/browser.css)
content/browser.js (content/browser.js)
content/PresentationView.xul (content/PresentationView.xul)
content/PresentationView.js (content/PresentationView.js)
content/bindings/checkbox.xml (content/bindings/checkbox.xml)
content/bindings/settings.xml (content/bindings/settings.xml)
content/netError.xhtml (content/netError.xhtml)
- content/SelectHelper.js (content/SelectHelper.js)
- content/ActionBarHandler.js (content/ActionBarHandler.js)
content/EmbedRT.js (content/EmbedRT.js)
- content/InputWidgetHelper.js (content/InputWidgetHelper.js)
- content/WebrtcUI.js (content/WebrtcUI.js)
content/MemoryObserver.js (content/MemoryObserver.js)
content/ConsoleAPI.js (content/ConsoleAPI.js)
content/PluginHelper.js (content/PluginHelper.js)
content/PrintHelper.js (content/PrintHelper.js)
content/OfflineApps.js (content/OfflineApps.js)
content/MasterPassword.js (content/MasterPassword.js)
content/FindHelper.js (content/FindHelper.js)
- content/FormAssistant.js (content/FormAssistant.js)
content/PermissionsHelper.js (content/PermissionsHelper.js)
content/FeedHandler.js (content/FeedHandler.js)
content/Feedback.js (content/Feedback.js)
content/Linkify.js (content/Linkify.js)
content/CastingApps.js (content/CastingApps.js)
content/RemoteDebugger.js (content/RemoteDebugger.js)
#ifdef MOZ_SERVICES_HEALTHREPORT
content/aboutHealthReport.xhtml (content/aboutHealthReport.xhtml)
--- a/mobile/android/components/BrowserCLH.js
+++ b/mobile/android/components/BrowserCLH.js
@@ -1,33 +1,24 @@
/* 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/. */
+"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
AppConstants: "resource://gre/modules/AppConstants.jsm",
DelayedInit: "resource://gre/modules/DelayedInit.jsm",
- EventDispatcher: "resource://gre/modules/Messaging.jsm",
GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
Services: "resource://gre/modules/Services.jsm",
});
-var Strings = {};
-
-XPCOMUtils.defineLazyGetter(Strings, "brand", _ =>
- Services.strings.createBundle("chrome://branding/locale/brand.properties"));
-XPCOMUtils.defineLazyGetter(Strings, "browser", _ =>
- Services.strings.createBundle("chrome://browser/locale/browser.properties"));
-XPCOMUtils.defineLazyGetter(Strings, "reader", _ =>
- Services.strings.createBundle("chrome://global/locale/aboutReader.properties"));
-
function BrowserCLH() {
this.wrappedJSObject = this;
}
BrowserCLH.prototype = {
/**
* Register resource://android as the APK root.
*
@@ -55,37 +46,37 @@ BrowserCLH.prototype = {
GeckoViewUtils.addLazyGetter(this, "DownloadNotifications", {
module: "resource://gre/modules/DownloadNotifications.jsm",
observers: ["chrome-document-loaded"],
once: true,
});
if (AppConstants.MOZ_WEBRTC) {
GeckoViewUtils.addLazyGetter(this, "WebrtcUI", {
- script: "chrome://browser/content/WebrtcUI.js",
+ module: "resource://gre/modules/WebrtcUI.jsm",
observers: [
"getUserMedia:ask-device-permission",
"getUserMedia:request",
"PeerConnection:request",
"recording-device-events",
"VideoCapture:Paused",
"VideoCapture:Resumed",
],
});
}
GeckoViewUtils.addLazyGetter(this, "SelectHelper", {
- script: "chrome://browser/content/SelectHelper.js",
+ module: "resource://gre/modules/SelectHelper.jsm",
});
GeckoViewUtils.addLazyGetter(this, "InputWidgetHelper", {
- script: "chrome://browser/content/InputWidgetHelper.js",
+ module: "resource://gre/modules/InputWidgetHelper.jsm",
});
GeckoViewUtils.addLazyGetter(this, "FormAssistant", {
- script: "chrome://browser/content/FormAssistant.js",
+ module: "resource://gre/modules/FormAssistant.jsm",
});
Services.obs.addObserver({
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIObserver, Ci.nsIFormSubmitObserver,
]),
notifyInvalidSubmit: (form, element) => {
this.FormAssistant.notifyInvalidSubmit(form, element);
},
@@ -104,17 +95,17 @@ BrowserCLH.prototype = {
// PLEASE KEEP THIS LIST IN SYNC WITH THE DESKTOP LIST IN nsBrowserGlue.js
],
});
GeckoViewUtils.addLazyGetter(this, "LoginManagerContent", {
module: "resource://gre/modules/LoginManagerContent.jsm",
});
GeckoViewUtils.addLazyGetter(this, "ActionBarHandler", {
- script: "chrome://browser/content/ActionBarHandler.js",
+ module: "resource://gre/modules/ActionBarHandler.jsm",
});
// Once the first chrome window is loaded, schedule a list of startup
// tasks to be performed on idle.
GeckoViewUtils.addLazyGetter(this, "DelayedStartup", {
observers: ["chrome-document-loaded"],
once: true,
handler: _ => DelayedInit.scheduleList([
rename from mobile/android/chrome/content/ActionBarHandler.js
rename to mobile/android/modules/ActionBarHandler.jsm
--- a/mobile/android/chrome/content/ActionBarHandler.js
+++ b/mobile/android/modules/ActionBarHandler.jsm
@@ -1,23 +1,37 @@
// -*- 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/. */
"use strict";
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+this.EXPORTED_SYMBOLS = ["ActionBarHandler"];
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
XPCOMUtils.defineLazyModuleGetters(this, {
+ EventDispatcher: "resource://gre/modules/Messaging.jsm",
+ GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
+ Services: "resource://gre/modules/Services.jsm",
Snackbars: "resource://gre/modules/Snackbars.jsm",
UITelemetry: "resource://gre/modules/UITelemetry.jsm",
});
XPCOMUtils.defineLazyServiceGetter(this, "ParentalControls",
"@mozilla.org/parental-controls-service;1", "nsIParentalControlsService");
+var Strings = {};
+
+XPCOMUtils.defineLazyGetter(Strings, "browser", _ =>
+ Services.strings.createBundle("chrome://browser/locale/browser.properties"));
+
const PHONE_REGEX = /^\+?[0-9\s,-.\(\)*#pw]{1,30}$/; // Are we a phone #?
/**
* ActionBarHandler Object and methods. Interface between Gecko Text Selection code
* (AccessibleCaret, etc) and the Mobile ActionBar UI.
*/
var ActionBarHandler = {
// Error codes returned from _init().
rename from mobile/android/chrome/content/FormAssistant.js
rename to mobile/android/modules/FormAssistant.jsm
--- a/mobile/android/chrome/content/FormAssistant.js
+++ b/mobile/android/modules/FormAssistant.jsm
@@ -1,15 +1,24 @@
/* 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/. */
-
"use strict";
-XPCOMUtils.defineLazyModuleGetter(this, "FormHistory", "resource://gre/modules/FormHistory.jsm");
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+this.EXPORTED_SYMBOLS = ["FormAssistant"];
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+XPCOMUtils.defineLazyModuleGetters(this, {
+ FormHistory: "resource://gre/modules/FormHistory.jsm",
+ GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
+ Services: "resource://gre/modules/Services.jsm",
+});
var FormAssistant = {
// Weak-ref used to keep track of the currently focused element.
_currentFocusedElement: null,
// Whether we're in the middle of an autocomplete.
_doingAutocomplete: false,
rename from mobile/android/chrome/content/InputWidgetHelper.js
rename to mobile/android/modules/InputWidgetHelper.jsm
--- a/mobile/android/chrome/content/InputWidgetHelper.js
+++ b/mobile/android/modules/InputWidgetHelper.jsm
@@ -1,15 +1,23 @@
/* 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/. */
"use strict";
-XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
- "resource://gre/modules/Prompt.jsm");
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+this.EXPORTED_SYMBOLS = ["InputWidgetHelper"];
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+XPCOMUtils.defineLazyModuleGetters(this, {
+ Prompt: "resource://gre/modules/Prompt.jsm",
+ Services: "resource://gre/modules/Services.jsm",
+});
var InputWidgetHelper = {
_uiBusy: false,
strings: function() {
if (!this._strings) {
this._strings = Services.strings.createBundle(
"chrome://browser/locale/browser.properties");
rename from mobile/android/chrome/content/SelectHelper.js
rename to mobile/android/modules/SelectHelper.jsm
--- a/mobile/android/chrome/content/SelectHelper.js
+++ b/mobile/android/modules/SelectHelper.jsm
@@ -1,15 +1,23 @@
/* 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/. */
"use strict";
-XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
- "resource://gre/modules/Prompt.jsm");
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+this.EXPORTED_SYMBOLS = ["SelectHelper"];
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+XPCOMUtils.defineLazyModuleGetters(this, {
+ Prompt: "resource://gre/modules/Prompt.jsm",
+ Services: "resource://gre/modules/Services.jsm",
+});
var SelectHelper = {
_uiBusy: false,
strings: function() {
if (!this._strings) {
this._strings = Services.strings.createBundle(
"chrome://browser/locale/browser.properties");
rename from mobile/android/chrome/content/WebrtcUI.js
rename to mobile/android/modules/WebrtcUI.jsm
--- a/mobile/android/chrome/content/WebrtcUI.js
+++ b/mobile/android/modules/WebrtcUI.jsm
@@ -1,22 +1,39 @@
/* 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/. */
"use strict";
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
this.EXPORTED_SYMBOLS = ["WebrtcUI"];
-XPCOMUtils.defineLazyServiceGetter(this, "MediaManagerService", "@mozilla.org/mediaManagerService;1", "nsIMediaManagerService");
-XPCOMUtils.defineLazyModuleGetter(this, "Notifications", "resource://gre/modules/Notifications.jsm");
-XPCOMUtils.defineLazyServiceGetter(this, "ParentalControls", "@mozilla.org/parental-controls-service;1", "nsIParentalControlsService");
-XPCOMUtils.defineLazyModuleGetter(this, "RuntimePermissions", "resource://gre/modules/RuntimePermissions.jsm");
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+XPCOMUtils.defineLazyModuleGetters(this, {
+ DoorHanger: "resource://gre/modules/Prompt.jsm",
+ Notifications: "resource://gre/modules/Notifications.jsm",
+ RuntimePermissions: "resource://gre/modules/RuntimePermissions.jsm",
+ Services: "resource://gre/modules/Services.jsm",
+});
-XPCOMUtils.defineLazyModuleGetter(this, "DoorHanger",
- "resource://gre/modules/Prompt.jsm");
+XPCOMUtils.defineLazyServiceGetter(this, "MediaManagerService",
+ "@mozilla.org/mediaManagerService;1",
+ "nsIMediaManagerService");
+XPCOMUtils.defineLazyServiceGetter(this, "ParentalControls",
+ "@mozilla.org/parental-controls-service;1",
+ "nsIParentalControlsService");
+
+var Strings = {};
+
+XPCOMUtils.defineLazyGetter(Strings, "brand", _ =>
+ Services.strings.createBundle("chrome://branding/locale/brand.properties"));
+XPCOMUtils.defineLazyGetter(Strings, "browser", _ =>
+ Services.strings.createBundle("chrome://browser/locale/browser.properties"));
var WebrtcUI = {
_notificationId: null,
// Add-ons can override stock permission behavior by doing:
//
// var stockObserve = WebrtcUI.observe;
//
--- a/mobile/android/modules/geckoview/GeckoViewUtils.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewUtils.jsm
@@ -17,56 +17,51 @@ this.EXPORTED_SYMBOLS = ["GeckoViewUtils
var GeckoViewUtils = {
/**
* Define a lazy getter that loads an object from external code, and
* optionally handles observer and/or message manager notifications for the
* object, so the object only loads when a notification is received.
*
* @param scope Scope for holding the loaded object.
* @param name Name of the object to load.
- * @param script If specified, load the object from a JS subscript.
* @param service If specified, load the object from a JS component; the
* component must include the line
* "this.wrappedJSObject = this;" in its constructor.
* @param module If specified, load the object from a JS module.
- * @param init For non-scripts, optional post-load initialization function.
+ * @param init Optional post-load initialization function.
* @param observers If specified, listen to specified observer notifications.
* @param ppmm If specified, listen to specified process messages.
* @param mm If specified, listen to specified frame messages.
* @param ged If specified, listen to specified global EventDispatcher events.
* @param once if true, only listen to the specified
* events/messages/notifications once.
*/
- addLazyGetter: function(scope, name, {script, service, module, handler,
+ addLazyGetter: function(scope, name, {service, module, handler,
observers, ppmm, mm, ged, init, once}) {
- if (script) {
- XPCOMUtils.defineLazyScriptGetter(scope, name, script);
- } else {
- XPCOMUtils.defineLazyGetter(scope, name, _ => {
- let ret = undefined;
- if (module) {
- ret = Cu.import(module, {})[name];
- } else if (service) {
- ret = Cc[service].getService(Ci.nsISupports).wrappedJSObject;
- } else if (typeof handler === "function") {
- ret = {
- handleEvent: handler,
- observe: handler,
- onEvent: handler,
- receiveMessage: handler,
- };
- } else if (handler) {
- ret = handler;
- }
- if (ret && init) {
- init.call(scope, ret);
- }
- return ret;
- });
- }
+ XPCOMUtils.defineLazyGetter(scope, name, _ => {
+ let ret = undefined;
+ if (module) {
+ ret = Cu.import(module, {})[name];
+ } else if (service) {
+ ret = Cc[service].getService(Ci.nsISupports).wrappedJSObject;
+ } else if (typeof handler === "function") {
+ ret = {
+ handleEvent: handler,
+ observe: handler,
+ onEvent: handler,
+ receiveMessage: handler,
+ };
+ } else if (handler) {
+ ret = handler;
+ }
+ if (ret && init) {
+ init.call(scope, ret);
+ }
+ return ret;
+ });
if (observers) {
let observer = (subject, topic, data) => {
Services.obs.removeObserver(observer, topic);
if (!once) {
Services.obs.addObserver(scope[name], topic);
}
scope[name].observe(subject, topic, data); // Explicitly notify new observer
--- a/mobile/android/modules/moz.build
+++ b/mobile/android/modules/moz.build
@@ -16,30 +16,35 @@ with Files('HomeProvider.jsm'):
with Files('geckoview/**'):
BUG_COMPONENT = ('Firefox for Android', 'GeckoView')
DIRS += ['geckoview']
EXTRA_JS_MODULES += [
'Accounts.jsm',
+ 'ActionBarHandler.jsm',
'BrowserActions.jsm',
'dbg-browser-actors.js',
'DelayedInit.jsm',
'DownloadNotifications.jsm',
+ 'FormAssistant.jsm',
'FxAccountsWebChannel.jsm',
'HelperApps.jsm',
'Home.jsm',
'HomeProvider.jsm',
+ 'InputWidgetHelper.jsm',
'JNI.jsm',
'LightweightThemeConsumer.jsm',
'MediaPlayerApp.jsm',
'NetErrorHelper.jsm',
'Notifications.jsm',
'PageActions.jsm',
'Prompt.jsm',
'RuntimePermissions.jsm',
'Sanitizer.jsm',
+ 'SelectHelper.jsm',
'SharedPreferences.jsm',
'Snackbars.jsm',
'SSLExceptions.jsm',
+ 'WebrtcUI.jsm',
'WebsiteMetadata.jsm'
]
--- a/mobile/android/tests/browser/chrome/test_hidden_select_option.html
+++ b/mobile/android/tests/browser/chrome/test_hidden_select_option.html
@@ -14,22 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
const VISIBLE_OPTION_COUNT = 5;
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
- Cu.import("resource://gre/modules/Services.jsm");
- Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
- let sandbox = {};
- Services.scriptloader.loadSubScript("chrome://browser/content/SelectHelper.js", sandbox);
- let SelectHelper = sandbox.SelectHelper;
+ Cu.import("resource://gre/modules/SelectHelper.jsm");
// Returns whether an element should be visible according to its text content.
function shouldBeVisible(e) {
return e.label.indexOf("visible") > 0;
}
// Returns an object for the callback method that would normally be created by Prompt.java's
// addListResult(..) method.
--- a/mobile/android/tests/browser/chrome/test_select_disabled.html
+++ b/mobile/android/tests/browser/chrome/test_select_disabled.html
@@ -11,22 +11,17 @@ https://bugzilla.mozilla.org/show_bug.cg
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
const VISIBLE_OPTION_COUNT = 5;
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
- Cu.import("resource://gre/modules/Services.jsm");
- Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
- let sandbox = {};
- Services.scriptloader.loadSubScript("chrome://browser/content/SelectHelper.js", sandbox);
- let SelectHelper = sandbox.SelectHelper;
+ Cu.import("resource://gre/modules/SelectHelper.jsm");
// Wait until the page has loaded so that we can access the DOM.
SimpleTest.waitForExplicitFinish();
window.onload = function() {
// test options are not incorrectly disabled...
let isEnabled1 = document.getElementById("is_enabled_1");
let isEnabled2 = document.getElementById("is_enabled_2");
ok(!SelectHelper._isDisabledElement(isEnabled1), "input with name=\"disabled\" should not disable options (bug 1263589)");