Commit a032f53a authored by Tooru Fujisawa's avatar Tooru Fujisawa
Browse files

Bug 1780543 - Part 5: Add mozilla/chrome-script environment. r=Standard8

parent 9fa82cdf
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
// assert is available to chrome scripts loaded via SpecialPowers.loadChromeScript.
/* global assert */
/* eslint-env mozilla/frame-script */
/* eslint-env mozilla/chrome-script */

"use strict";

+1 −1
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@ add_task(async function test_DE_is_valid_testcase() {
    ],
  });
  let chromeScript = SpecialPowers.loadChromeScript(function test_country_data() {
    /* eslint-env mozilla/chrome-script */
    const {AddressDataLoader} = ChromeUtils.import("resource://autofill/FormAutofillUtils.jsm");
    let data = AddressDataLoader.getData("DE");
    /* global addMessageListener */
    addMessageListener("CheckSubKeys", () => {
      return !data.defaultLocale.sub_keys;
    });
+1 −2
Original line number Diff line number Diff line
@@ -81,12 +81,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=509055
        sheTitle = sh.legacySHistory.getEntryAtIndex(sh.index).title;
      } else {
        let chromeScript = SpecialPowers.loadChromeScript(() => {
          // eslint-disable-next-line no-undef
          /* eslint-env mozilla/chrome-script */
          addMessageListener("getTitle", browsingContext => {
            // eslint-disable-next-line no-shadow
            let sh = browsingContext.sessionHistory;
            let title = sh.getEntryAtIndex(sh.index).title;
            // eslint-disable-next-line no-undef
            sendAsyncMessage("title", title);
          });
        });
+1 −3
Original line number Diff line number Diff line
@@ -20,17 +20,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=
    let chromeScript = null;
    if (SpecialPowers.Services.appinfo.sessionHistoryInParent) {
      chromeScript = SpecialPowers.loadChromeScript(() => {
        /* eslint-env mozilla/chrome-script */
        function doSend(message, fn) {
          try {
            // eslint-disable-next-line no-undef
            sendAsyncMessage(message, {success: true, value: fn()});
          } catch(_) {
            // eslint-disable-next-line no-undef
            sendAsyncMessage(message, {success: false});
          }
        }

        // eslint-disable-next-line no-undef
        addMessageListener("requestedIndex", (id) => {
          doSend("requestedIndex", () => {
            let shistory = BrowsingContext.get(id).top.sessionHistory;
+1 −3
Original line number Diff line number Diff line
@@ -26,17 +26,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1375833
    let chromeScript = null;
    if (SpecialPowers.Services.appinfo.sessionHistoryInParent) {
      chromeScript = SpecialPowers.loadChromeScript(() => {
        /* eslint-env mozilla/chrome-script */
        function doSend(message, fn) {
          try {
            // eslint-disable-next-line no-undef
            sendAsyncMessage(message, {success: true, value: fn()});
          } catch(_) {
            // eslint-disable-next-line no-undef
            sendAsyncMessage(message, {success: false});
          }
        }

        // eslint-disable-next-line no-undef
        addMessageListener("test1", id => {
          doSend("test1", () => {
            let sessionHistory = BrowsingContext.get(id).top.sessionHistory;
Loading