/* 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"; dump("######################## BrowserElementChildPreload.js loaded\n"); var BrowserElementIsReady = false; var { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/BrowserElementPromptService.jsm"); Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/Microformats.js"); Cu.import("resource://gre/modules/ExtensionContent.jsm"); XPCOMUtils.defineLazyServiceGetter(this, "acs", "@mozilla.org/audiochannel/service;1", "nsIAudioChannelService"); XPCOMUtils.defineLazyModuleGetter(this, "ManifestFinder", "resource://gre/modules/ManifestFinder.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "ManifestObtainer", "resource://gre/modules/ManifestObtainer.jsm"); var kLongestReturnedString = 128; function debug(msg) { //dump("BrowserElementChildPreload - " + msg + "\n"); } function sendAsyncMsg(msg, data) { // Ensure that we don't send any messages before BrowserElementChild.js // finishes loading. if (!BrowserElementIsReady) return; if (!data) { data = { }; } data.msg_name = msg; sendAsyncMessage('browser-element-api:call', data); } function sendSyncMsg(msg, data) { // Ensure that we don't send any messages before BrowserElementChild.js // finishes loading. if (!BrowserElementIsReady) return; if (!data) { data = { }; } data.msg_name = msg; return sendSyncMessage('browser-element-api:call', data); } var CERTIFICATE_ERROR_PAGE_PREF = 'security.alternate_certificate_error_page'; const OBSERVED_EVENTS = [ 'xpcom-shutdown', 'audio-playback', 'activity-done', 'invalid-widget' ]; const COMMAND_MAP = { 'cut': 'cmd_cut', 'copy': 'cmd_copyAndCollapseToEnd', 'copyImage': 'cmd_copyImage', 'copyLink': 'cmd_copyLink', 'paste': 'cmd_paste', 'selectall': 'cmd_selectAll' }; /** * The BrowserElementChild implements one half of