dom/browser-element/BrowserElementChild.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 "use strict";
michael@0 6
michael@0 7 let { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
michael@0 8 Cu.import("resource://gre/modules/Services.jsm");
michael@0 9
michael@0 10 function debug(msg) {
michael@0 11 //dump("BrowserElementChild - " + msg + "\n");
michael@0 12 }
michael@0 13
michael@0 14 // NB: this must happen before we process any messages from
michael@0 15 // mozbrowser API clients.
michael@0 16 docShell.isActive = true;
michael@0 17
michael@0 18 function parentDocShell(docshell) {
michael@0 19 if (!docshell) {
michael@0 20 return null;
michael@0 21 }
michael@0 22 let treeitem = docshell.QueryInterface(Ci.nsIDocShellTreeItem);
michael@0 23 return treeitem.parent ? treeitem.parent.QueryInterface(Ci.nsIDocShell) : null;
michael@0 24 }
michael@0 25
michael@0 26 function isTopBrowserElement(docShell) {
michael@0 27 while (docShell) {
michael@0 28 docShell = parentDocShell(docShell);
michael@0 29 if (docShell && docShell.isBrowserOrApp) {
michael@0 30 return false;
michael@0 31 }
michael@0 32 }
michael@0 33 return true;
michael@0 34 }
michael@0 35
michael@0 36 if (!('BrowserElementIsPreloaded' in this)) {
michael@0 37 if (isTopBrowserElement(docShell) &&
michael@0 38 Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
michael@0 39 try {
michael@0 40 Services.scriptloader.loadSubScript("chrome://global/content/forms.js");
michael@0 41 } catch (e) {
michael@0 42 }
michael@0 43 }
michael@0 44
michael@0 45 Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementPanning.js");
michael@0 46 ContentPanning.init();
michael@0 47
michael@0 48 Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementChildPreload.js");
michael@0 49 } else {
michael@0 50 ContentPanning.init();
michael@0 51 }
michael@0 52
michael@0 53 var BrowserElementIsReady = true;
michael@0 54
michael@0 55 let infos = sendSyncMessage('browser-element-api:call',
michael@0 56 { 'msg_name': 'hello' })[0];
michael@0 57 docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name;
michael@0 58 docShell.setFullscreenAllowed(infos.fullscreenAllowed);

mercurial