Skip to content

Instantly share code, notes, and snippets.

@ochameau
Created May 13, 2019 09:55
Show Gist options
  • Save ochameau/9041b3124e558c52132d9f42ef9b1110 to your computer and use it in GitHub Desktop.
Save ochameau/9041b3124e558c52132d9f42ef9b1110 to your computer and use it in GitHub Desktop.
diff --git a/testing/talos/talos/tests/devtools/addon/content/tests/debugger/custom.js b/testing/talos/talos/tests/devtools/addon/content/tests/debugger/custom.js
index 320ce3b1768f..e6a848404bc4 100644
--- a/testing/talos/talos/tests/devtools/addon/content/tests/debugger/custom.js
+++ b/testing/talos/talos/tests/devtools/addon/content/tests/debugger/custom.js
@@ -96,14 +96,33 @@ async function stepDebuggerAndLog(tab, toolbox, testFunction) {
}
}
+function screenshot(win) {
+ const canvas = win.document.createElementNS(
+ "http://www.w3.org/1999/xhtml",
+ "html:canvas"
+ );
+ const context = canvas.getContext("2d");
+ canvas.width = win.innerWidth;
+ canvas.height = win.innerHeight;
+ context.drawWindow(win, 0, 0, canvas.width, canvas.height, "white");
+ const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
+ gBrowser.addTab(canvas.toDataURL(), {
+ triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
+ });
+}
async function testProjectSearch(tab, toolbox) {
const panel = await toolbox.getPanelWhenReady("jsdebugger");
const dbg = await createContext(panel);
const cx = dbg.selectors.getContext(dbg.getState());
dump("Executing project search\n");
+ screenshot(panel.panelWin);
const test = runTest(`custom.jsdebugger.project-search.DAMP`);
await dbg.actions.searchSources(cx, "return");
+
+ screenshot(panel.panelWin);
+ await new Promise(()=> {});
+
test.done();
await garbageCollect();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment