commit 74c4ec96ed828ab4749aab4f187f86b37bf557a0
parent 14e953f61591b39ab4221df8526d7b8d66820bfb
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Mon, 8 Dec 2025 16:20:39 +0000
Bug 2004217 - [devtools] Turn devtools/server/tests/xpcshell/test_layout-reflows-observer.js into an ES class. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D275480
Diffstat:
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/devtools/server/tests/xpcshell/test_layout-reflows-observer.js b/devtools/server/tests/xpcshell/test_layout-reflows-observer.js
@@ -41,10 +41,10 @@ class MockTargetActor extends EventEmitter {
}
}
-function MockWindow(docShell) {
- this.docShell = docShell;
-}
-MockWindow.prototype = {
+class MockWindow {
+ constructor(docShell) {
+ this.docShell = docShell;
+ }
QueryInterface() {
const self = this;
return {
@@ -56,23 +56,23 @@ MockWindow.prototype = {
};
},
};
- },
+ }
setTimeout(cb) {
// Simply return the cb itself so that we can execute it in the test instead
// of depending on a real timeout
return cb;
- },
- clearTimeout() {},
-};
-
-function MockDocShell() {
- this.observer = null;
+ }
+ clearTimeout() {}
}
-MockDocShell.prototype = {
+
+class MockDocShell {
+ constructor() {
+ this.observer = null;
+ }
addWeakReflowObserver(observer) {
this.observer = observer;
- },
- removeWeakReflowObserver() {},
+ }
+ removeWeakReflowObserver() {}
get chromeEventHandler() {
return {
addEventListener: (type, cb) => {
@@ -86,13 +86,13 @@ MockDocShell.prototype = {
}
},
};
- },
+ }
mockResize() {
if (this.resizeCb) {
this.resizeCb();
}
- },
-};
+ }
+}
function run_test() {
instancesOfObserversAreSharedBetweenWindows();