/* 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; let { 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"); let 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); } let CERTIFICATE_ERROR_PAGE_PREF = 'security.alternate_certificate_error_page'; const OBSERVED_EVENTS = [ 'fullscreen-origin-change', 'ask-parent-to-exit-fullscreen', 'ask-parent-to-rollback-fullscreen', 'xpcom-shutdown', 'activity-done' ]; const COMMAND_MAP = { 'cut': 'cmd_cut', 'copy': 'cmd_copy', 'paste': 'cmd_paste', 'selectall': 'cmd_selectAll' }; /** * The BrowserElementChild implements one half of