Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1824589) for causing multiple failures. …
Browse files Browse the repository at this point in the history
…CLOSED TREE

Backed out changeset 3c5d419b0116 (bug 1824589)
Backed out changeset a095ef588eda (bug 1824589)
  • Loading branch information
chorotan committed Mar 27, 2023
1 parent a2a7af5 commit 2893fee
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 30 deletions.
2 changes: 1 addition & 1 deletion browser/base/content/test/permissions/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { PermissionTestUtils } = ChromeUtils.import(

SpecialPowers.addTaskImport(
"E10SUtils",
"resource://gre/modules/E10SUtils.sys.mjs"
"resource://gre/modules/E10SUtils.jsm"
);

function openPermissionPopup() {
Expand Down
2 changes: 1 addition & 1 deletion dom/security/DOMSecurityMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void DOMSecurityMonitor::AuditParsingOfHTMLXMLFragments(
nsLiteralCString("resource://devtools/client/shared/widgets/tooltip/"
"inactive-css-tooltip-helper.js"),
"resource://devtools/client/shared/widgets/Spectrum.js"_ns,
"resource://gre/modules/narrate/VoiceSelect.sys.mjs"_ns,
"resource://gre/modules/narrate/VoiceSelect.jsm"_ns,
"resource://normandy-vendor/ReactDOM.js"_ns,
// ------------------------------------------------------------------
// test pages
Expand Down
2 changes: 1 addition & 1 deletion testing/specialpowers/content/SpecialPowersChild.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ export class SpecialPowersChild extends JSWindowActorChild {
}

/**
* Automatically imports the given symbol from the given sys.mjs for any
* Automatically imports the given symbol from the given JSM for any
* task spawned by this SpecialPowers instance.
*/
addTaskImport(symbol, url) {
Expand Down
7 changes: 3 additions & 4 deletions testing/specialpowers/content/SpecialPowersSandbox.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ export class SpecialPowersSandbox {
...EXTRA_IMPORTS,
...opts.imports,
};
// We explicitly want these directly in the sandbox, and we aren't going
// to be using the globals within this file.
// eslint-disable-next-line mozilla/lazy-getter-object-name
ChromeUtils.defineESModuleGetters(this.sandbox, imports);
for (let [symbol, url] of Object.entries(imports)) {
ChromeUtils.defineModuleGetter(this.sandbox, symbol, url);
}

// Note: When updating the set of globals exposed to sandboxes by
// default, please also update the ESLint plugin rule defined in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@
* 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/. */

import { AsyncPrefs } from "resource://gre/modules/AsyncPrefs.sys.mjs";
import { Narrator } from "resource://gre/modules/narrate/Narrator.sys.mjs";
import { VoiceSelect } from "resource://gre/modules/narrate/VoiceSelect.sys.mjs";
"use strict";

const { VoiceSelect } = ChromeUtils.import(
"resource://gre/modules/narrate/VoiceSelect.jsm"
);
const { Narrator } = ChromeUtils.import(
"resource://gre/modules/narrate/Narrator.jsm"
);
const { AsyncPrefs } = ChromeUtils.importESModule(
"resource://gre/modules/AsyncPrefs.sys.mjs"
);

var EXPORTED_SYMBOLS = ["NarrateControls"];

var gStrings = Services.strings.createBundle(
"chrome://global/locale/narrate.properties"
);

export function NarrateControls(win, languagePromise) {
function NarrateControls(win, languagePromise) {
this._winRef = Cu.getWeakReference(win);
this._languagePromise = languagePromise;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* 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";

var EXPORTED_SYMBOLS = ["Narrator"];

// Maximum time into paragraph when pressing "skip previous" will go
// to previous paragraph and not the start of current one.
const PREV_THRESHOLD = 2000;
Expand All @@ -21,7 +25,7 @@ const kTextStylesRules = [
"word-spacing",
];

export function Narrator(win, languagePromise) {
function Narrator(win, languagePromise) {
this._winRef = Cu.getWeakReference(win);
this._languagePromise = languagePromise;
this._inTest = Services.prefs.getBoolPref("narrate.test");
Expand Down Expand Up @@ -323,8 +327,8 @@ Highlighter.prototype = {
/**
* Highlight the range within offsets relative to the container.
*
* @param {number} startOffset the start offset
* @param {number} length the length in characters of the range
* @param {Number} startOffset the start offset
* @param {Number} length the length in characters of the range
*/
highlight(startOffset, length) {
let containerRect = this.container.getBoundingClientRect();
Expand Down Expand Up @@ -388,7 +392,7 @@ Highlighter.prototype = {
* Returns specified amount of highlight nodes. Creates new ones if necessary
* and purges any additional nodes that are not needed.
*
* @param {number} count number of nodes needed
* @param {Number} count number of nodes needed
*/
_getFreshHighlightNodes(count) {
let doc = this.container.ownerDocument;
Expand All @@ -414,8 +418,8 @@ Highlighter.prototype = {
* Create and return a range object with the start and end offsets relative
* to the container node.
*
* @param {number} startOffset the start offset
* @param {number} endOffset the end offset
* @param {Number} startOffset the start offset
* @param {Number} endOffset the end offset
*/
_getRange(startOffset, endOffset) {
let doc = this.container.ownerDocument;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
* 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/. */

export function VoiceSelect(win, label) {
"use strict";

var EXPORTED_SYMBOLS = ["VoiceSelect"];

function VoiceSelect(win, label) {
this._winRef = Cu.getWeakReference(win);

let element = win.document.createElement("div");
Expand Down
6 changes: 1 addition & 5 deletions toolkit/components/narrate/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
with Files("**"):
BUG_COMPONENT = ("Toolkit", "Reader Mode")

EXTRA_JS_MODULES.narrate = [
"NarrateControls.sys.mjs",
"Narrator.sys.mjs",
"VoiceSelect.sys.mjs",
]
EXTRA_JS_MODULES.narrate = ["NarrateControls.jsm", "Narrator.jsm", "VoiceSelect.jsm"]

BROWSER_CHROME_MANIFESTS += ["test/browser.ini"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
* 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/. */

import { ContentTaskUtils } from "resource://testing-common/ContentTaskUtils.sys.mjs";
import { Preferences } from "resource://gre/modules/Preferences.sys.mjs";
import { setTimeout } from "resource://gre/modules/Timer.sys.mjs";
"use strict";

export var NarrateTestUtils = {
const { Preferences } = ChromeUtils.importESModule(
"resource://gre/modules/Preferences.sys.mjs"
);
const { ContentTaskUtils } = ChromeUtils.importESModule(
"resource://testing-common/ContentTaskUtils.sys.mjs"
);
const { setTimeout } = ChromeUtils.importESModule(
"resource://gre/modules/Timer.sys.mjs"
);

var EXPORTED_SYMBOLS = ["NarrateTestUtils"];

var NarrateTestUtils = {
TOGGLE: ".narrate-toggle",
POPUP: ".narrate-dropdown .dropdown-popup",
VOICE_SELECT: ".narrate-voices .select-toggle",
Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/narrate/test/browser.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[DEFAULT]
support-files =
head.js
NarrateTestUtils.sys.mjs
NarrateTestUtils.jsm
moby_dick.html

[browser_narrate.js]
Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/narrate/test/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function spawnInNewReaderTab(url, func) {
SpecialPowers.addTaskImport(
"NarrateTestUtils",
"chrome://mochitests/content/browser/" +
"toolkit/components/narrate/test/NarrateTestUtils.sys.mjs"
"toolkit/components/narrate/test/NarrateTestUtils.jsm"
);
await SpecialPowers.spawn(browser, [], async function() {
await NarrateTestUtils.getReaderReadyPromise(content);
Expand Down
6 changes: 5 additions & 1 deletion toolkit/components/reader/AboutReader.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ const lazy = {};

ChromeUtils.defineESModuleGetters(lazy, {
AsyncPrefs: "resource://gre/modules/AsyncPrefs.sys.mjs",
NarrateControls: "resource://gre/modules/narrate/NarrateControls.sys.mjs",
});
ChromeUtils.defineModuleGetter(
lazy,
"NarrateControls",
"resource://gre/modules/narrate/NarrateControls.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"NimbusFeatures",
Expand Down

0 comments on commit 2893fee

Please sign in to comment.