2012-05-08 20:20:35 +04:00
|
|
|
/* 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";
|
|
|
|
|
2012-07-20 10:48:27 +04:00
|
|
|
let { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
2012-06-07 18:43:23 +04:00
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
2012-05-23 18:15:31 +04:00
|
|
|
|
2012-05-08 20:20:35 +04:00
|
|
|
function debug(msg) {
|
2012-05-09 03:17:10 +04:00
|
|
|
//dump("BrowserElementChild - " + msg + "\n");
|
2012-05-08 20:20:35 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 09:10:01 +04:00
|
|
|
// NB: this must happen before we process any messages from
|
|
|
|
// mozbrowser API clients.
|
|
|
|
docShell.isActive = true;
|
2012-12-06 21:03:27 +04:00
|
|
|
|
2013-12-08 19:28:47 +04:00
|
|
|
function parentDocShell(docshell) {
|
|
|
|
if (!docshell) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
let treeitem = docshell.QueryInterface(Ci.nsIDocShellTreeItem);
|
|
|
|
return treeitem.parent ? treeitem.parent.QueryInterface(Ci.nsIDocShell) : null;
|
|
|
|
}
|
|
|
|
|
|
|
|
function isTopBrowserElement(docShell) {
|
|
|
|
while (docShell) {
|
|
|
|
docShell = parentDocShell(docShell);
|
|
|
|
if (docShell && docShell.isBrowserOrApp) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-02-08 09:10:01 +04:00
|
|
|
if (!('BrowserElementIsPreloaded' in this)) {
|
2015-05-28 08:57:00 +03:00
|
|
|
if (isTopBrowserElement(docShell)) {
|
|
|
|
if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
|
|
|
|
try {
|
|
|
|
Services.scriptloader.loadSubScript("chrome://global/content/forms.js");
|
|
|
|
} catch (e) {
|
|
|
|
}
|
2013-11-11 18:11:43 +04:00
|
|
|
}
|
2015-05-28 08:57:00 +03:00
|
|
|
|
|
|
|
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js");
|
2013-11-11 18:11:43 +04:00
|
|
|
}
|
2013-12-06 00:47:19 +04:00
|
|
|
|
2015-03-06 03:38:51 +03:00
|
|
|
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") == 1) {
|
|
|
|
if (docShell.asyncPanZoomEnabled === false) {
|
|
|
|
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanningAPZDisabled.js");
|
|
|
|
ContentPanningAPZDisabled.init();
|
|
|
|
}
|
2015-02-25 21:33:21 +03:00
|
|
|
|
2015-03-06 03:38:51 +03:00
|
|
|
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js");
|
|
|
|
ContentPanning.init();
|
|
|
|
}
|
2013-12-06 00:47:19 +04:00
|
|
|
|
2013-02-08 09:10:01 +04:00
|
|
|
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementChildPreload.js");
|
2013-12-06 00:47:19 +04:00
|
|
|
} else {
|
2015-03-06 03:38:51 +03:00
|
|
|
if (Services.prefs.getIntPref("dom.w3c_touch_events.enabled") == 1) {
|
|
|
|
if (docShell.asyncPanZoomEnabled === false) {
|
|
|
|
ContentPanningAPZDisabled.init();
|
|
|
|
}
|
|
|
|
ContentPanning.init();
|
2015-02-25 21:33:21 +03:00
|
|
|
}
|
2013-02-08 09:10:01 +04:00
|
|
|
}
|
2012-07-20 10:48:27 +04:00
|
|
|
|
2013-02-08 09:10:01 +04:00
|
|
|
var BrowserElementIsReady = true;
|
2014-04-02 16:51:46 +04:00
|
|
|
|
2014-11-24 22:05:35 +03:00
|
|
|
|
|
|
|
sendAsyncMessage('browser-element-api:call', { 'msg_name': 'hello' });
|