2012-05-08 09:20:35 -07: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-19 23:48:27 -07:00
|
|
|
let { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
2012-05-11 00:47:40 -07:00
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
2012-06-07 07:43:23 -07:00
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
2012-07-19 23:48:27 -07:00
|
|
|
Cu.import("resource://gre/modules/Geometry.jsm");
|
2012-05-23 07:15:31 -07:00
|
|
|
|
2012-05-08 09:20:35 -07:00
|
|
|
function debug(msg) {
|
2012-05-08 16:17:10 -07:00
|
|
|
//dump("BrowserElementChild - " + msg + "\n");
|
2012-05-08 09:20:35 -07:00
|
|
|
}
|
|
|
|
|
2013-02-07 21:10:01 -08:00
|
|
|
// NB: this must happen before we process any messages from
|
|
|
|
// mozbrowser API clients.
|
|
|
|
docShell.isActive = true;
|
2012-12-06 09:03:27 -08:00
|
|
|
|
2013-02-07 21:10:01 -08:00
|
|
|
let infos = sendSyncMessage('browser-element-api:call',
|
|
|
|
{ 'msg_name': 'hello' })[0];
|
|
|
|
docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name;
|
|
|
|
docShell.setFullscreenAllowed(infos.fullscreenAllowed);
|
2012-12-06 09:03:27 -08:00
|
|
|
|
|
|
|
|
2013-12-08 07:28:47 -08: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-07 21:10:01 -08:00
|
|
|
if (!('BrowserElementIsPreloaded' in this)) {
|
2013-12-08 07:28:47 -08:00
|
|
|
if (isTopBrowserElement(docShell) &&
|
|
|
|
Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
|
|
|
|
try {
|
2013-11-11 06:11:43 -08:00
|
|
|
Services.scriptloader.loadSubScript("chrome://global/content/forms.js");
|
2013-12-08 07:28:47 -08:00
|
|
|
} catch (e) {
|
2013-11-11 06:11:43 -08:00
|
|
|
}
|
|
|
|
}
|
2013-10-19 03:30:32 -07:00
|
|
|
// Those are produc-specific files that's sometimes unavailable.
|
2013-02-07 21:10:01 -08:00
|
|
|
try {
|
2013-10-19 03:30:32 -07:00
|
|
|
Services.scriptloader.loadSubScript("chrome://browser/content/ErrorPage.js");
|
2013-02-07 21:10:01 -08:00
|
|
|
} catch (e) {
|
2012-09-26 15:03:25 -07:00
|
|
|
}
|
2013-12-05 12:47:19 -08:00
|
|
|
|
2013-02-07 21:10:01 -08:00
|
|
|
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js");
|
2013-12-05 12:47:19 -08:00
|
|
|
ContentPanning.init();
|
|
|
|
|
2013-02-07 21:10:01 -08:00
|
|
|
Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementChildPreload.js");
|
2013-12-05 12:47:19 -08:00
|
|
|
} else {
|
|
|
|
ContentPanning.init();
|
2013-02-07 21:10:01 -08:00
|
|
|
}
|
2012-07-19 23:48:27 -07:00
|
|
|
|
2013-02-07 21:10:01 -08:00
|
|
|
var BrowserElementIsReady = true;
|