/* 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"; let Cu = Components.utils; let Ci = Components.interfaces; let Cc = Components.classes; let Cr = Components.results; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/BrowserElementPromptService.jsm"); XPCOMUtils.defineLazyGetter(this, "DOMApplicationRegistry", function () { Cu.import("resource://gre/modules/Webapps.jsm"); return DOMApplicationRegistry; }); const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed"; const BROWSER_FRAMES_ENABLED_PREF = "dom.mozBrowserFramesEnabled"; const TOUCH_EVENTS_ENABLED_PREF = "dom.w3c_touch_events.enabled"; function debug(msg) { //dump("BrowserElementParent - " + msg + "\n"); } function getBoolPref(prefName, def) { try { return Services.prefs.getBoolPref(prefName); } catch(err) { return def; } } function getIntPref(prefName, def) { try { return Services.prefs.getIntPref(prefName); } catch(err) { return def; } } function exposeAll(obj) { // Filter for Objects and Arrays. if (typeof obj !== "object" || !obj) return; // Recursively expose our children. Object.keys(obj).forEach(function(key) { exposeAll(obj[key]); }); // If we're not an Array, generate an __exposedProps__ object for ourselves. if (obj instanceof Array) return; var exposed = {}; Object.keys(obj).forEach(function(key) { exposed[key] = 'rw'; }); obj.__exposedProps__ = exposed; } function defineAndExpose(obj, name, value) { obj[name] = value; if (!('__exposedProps__' in obj)) obj.__exposedProps__ = {}; obj.__exposedProps__[name] = 'r'; } /** * BrowserElementParent implements one half of