Bug 1465491 - Add remaining web replay tests.
authorBrian Hackett <bhackett1024@gmail.com>
Fri, 10 Aug 2018 18:20:15 +0000
changeset 431104 39ad7ffcd976cb51d908f139c9d19f1e112ee4f5
parent 431103 e6b953e50fbf75c58fb122520e0abd09662b1019
child 431105 4bf146738292330c1fba2dc84df3ecb27e09872c
child 431106 1ec7f635f4f371bd95b494f68583047d49ca7ee8
push id34424
push useraciure@mozilla.com
push dateSat, 11 Aug 2018 21:54:22 +0000
treeherdermozilla-central@4bf146738292 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1465491
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1465491 - Add remaining web replay tests.
devtools/client/debugger/new/test/mochitest/browser.ini
devtools/client/debugger/new/test/mochitest/browser_dbg_rr_recovery-01.js
devtools/client/debugger/new/test/mochitest/browser_dbg_rr_replay-01.js
devtools/client/debugger/new/test/mochitest/browser_dbg_rr_replay-02.js
devtools/client/debugger/new/test/mochitest/browser_dbg_rr_replay-03.js
devtools/client/debugger/new/test/mochitest/examples/doc_rr_recovery.html
--- a/devtools/client/debugger/new/test/mochitest/browser.ini
+++ b/devtools/client/debugger/new/test/mochitest/browser.ini
@@ -625,16 +625,17 @@ support-files =
   examples/frames.js
   examples/pause-points.js
   examples/script-mutate.js
   examples/script-switching-02.js
   examples/script-switching-01.js
   examples/times2.js
   examples/doc_rr_basic.html
   examples/doc_rr_continuous.html
+  examples/doc_rr_recovery.html
 
 [browser_dbg-asm.js]
 [browser_dbg-async-stepping.js]
 [browser_dbg-sourcemapped-breakpoint-console.js]
 skip-if = (os == "win" && ccov) # Bug 1453549
 [browser_dbg-sourcemapped-scopes.js]
 skip-if = ccov || (verify && debug && (os == 'linux')) # Bug 1441545
 [browser_dbg-sourcemapped-stepping.js]
@@ -734,8 +735,16 @@ skip-if = os != "mac" || debug || !night
 [browser_dbg_rr_stepping-01.js]
 skip-if = os != "mac" || debug || !nightly_build
 [browser_dbg_rr_stepping-02.js]
 skip-if = os != "mac" || debug || !nightly_build
 [browser_dbg_rr_stepping-03.js]
 skip-if = os != "mac" || debug || !nightly_build
 [browser_dbg_rr_stepping-04.js]
 skip-if = os != "mac" || debug || !nightly_build
+[browser_dbg_rr_recovery-01.js]
+skip-if = os != "mac" || debug || !nightly_build
+[browser_dbg_rr_replay-01.js]
+skip-if = os != "mac" || debug || !nightly_build
+[browser_dbg_rr_replay-02.js]
+skip-if = os != "mac" || debug || !nightly_build
+[browser_dbg_rr_replay-03.js]
+skip-if = os != "mac" || debug || !nightly_build
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg_rr_recovery-01.js
@@ -0,0 +1,28 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test basic recovery of crashed child processes in web replay.
+async function test() {
+  waitForExplicitFinish();
+
+  let tab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });
+  gBrowser.selectedTab = tab;
+  openTrustedLinkIn(EXAMPLE_URL + "doc_rr_recovery.html", "current");
+  await once(Services.ppmm, "RecordingFinished");
+
+  let toolbox = await attachDebugger(tab), client = toolbox.threadClient;
+  await client.interrupt();
+  await setBreakpoint(client, "doc_rr_recovery.html", 21);
+  await rewindToLine(client, 21);
+  await checkEvaluateInTopFrame(client, "SpecialPowers.Cu.recordReplayDirective(/* CrashSoon */ 1)", undefined);
+  await stepOverToLine(client, 22);
+  await stepOverToLine(client, 23);
+  await checkEvaluateInTopFrame(client, "SpecialPowers.Cu.recordReplayDirective(/* CrashSoon */ 1); " +
+                                        "SpecialPowers.Cu.recordReplayDirective(/* MaybeCrash */ 2)", undefined);
+
+  await toolbox.destroy();
+  await gBrowser.removeTab(tab);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg_rr_replay-01.js
@@ -0,0 +1,39 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Basic test for saving a recording and then replaying it in a new tab.
+async function test() {
+  waitForExplicitFinish();
+
+  let recordingFile = newRecordingFile();
+  let recordingTab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });
+  gBrowser.selectedTab = recordingTab;
+  openTrustedLinkIn(EXAMPLE_URL + "doc_rr_basic.html", "current");
+  await once(Services.ppmm, "RecordingFinished");
+
+  let tabParent = recordingTab.linkedBrowser.frameLoader.tabParent;
+  ok(tabParent, "Found recording tab parent");
+  ok(tabParent.saveRecording(recordingFile), "Saved recording");
+  await once(Services.ppmm, "SaveRecordingFinished");
+
+  let replayingTab = BrowserTestUtils.addTab(gBrowser, null, { replayExecution: recordingFile });
+  gBrowser.selectedTab = replayingTab;
+  await once(Services.ppmm, "HitRecordingEndpoint");
+
+  let toolbox = await attachDebugger(replayingTab), client = toolbox.threadClient;
+  await client.interrupt();
+  await setBreakpoint(client, "doc_rr_basic.html", 21);
+  await rewindToLine(client, 21);
+  await checkEvaluateInTopFrame(client, "number", 10);
+  await rewindToLine(client, 21);
+  await checkEvaluateInTopFrame(client, "number", 9);
+  await resumeToLine(client, 21);
+  await checkEvaluateInTopFrame(client, "number", 10);
+
+  await toolbox.destroy();
+  await gBrowser.removeTab(recordingTab);
+  await gBrowser.removeTab(replayingTab);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg_rr_replay-02.js
@@ -0,0 +1,49 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test ending a recording at a breakpoint and then separately replaying to the end.
+async function test() {
+  waitForExplicitFinish();
+
+  let recordingFile = newRecordingFile();
+  let recordingTab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });
+  gBrowser.selectedTab = recordingTab;
+  openTrustedLinkIn(EXAMPLE_URL + "doc_rr_continuous.html", "current");
+
+  let toolbox = await attachDebugger(recordingTab), client = toolbox.threadClient;
+  await client.interrupt();
+  await setBreakpoint(client, "doc_rr_continuous.html", 14);
+  await resumeToLine(client, 14);
+  await resumeToLine(client, 14);
+  await reverseStepOverToLine(client, 13);
+  let lastNumberValue = await evaluateInTopFrame(client, "number");
+
+  let tabParent = recordingTab.linkedBrowser.frameLoader.tabParent;
+  ok(tabParent, "Found recording tab parent");
+  ok(tabParent.saveRecording(recordingFile), "Saved recording");
+  await once(Services.ppmm, "SaveRecordingFinished");
+
+  await toolbox.destroy();
+  await gBrowser.removeTab(recordingTab);
+
+  let replayingTab = BrowserTestUtils.addTab(gBrowser, null, { replayExecution: recordingFile });
+  gBrowser.selectedTab = replayingTab;
+  await once(Services.ppmm, "HitRecordingEndpoint");
+
+  toolbox = await attachDebugger(replayingTab);
+  client = toolbox.threadClient;
+  await client.interrupt();
+  await checkEvaluateInTopFrame(client, "number", lastNumberValue);
+  await reverseStepOverToLine(client, 13);
+  await setBreakpoint(client, "doc_rr_continuous.html", 14);
+  await rewindToLine(client, 14);
+  await checkEvaluateInTopFrame(client, "number", lastNumberValue - 1);
+  await resumeToLine(client, 14);
+  await checkEvaluateInTopFrame(client, "number", lastNumberValue);
+
+  await toolbox.destroy();
+  await gBrowser.removeTab(replayingTab);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg_rr_replay-03.js
@@ -0,0 +1,32 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test for saving a recording and then replaying it in a new tab, with rewinding disabled.
+async function test() {
+  waitForExplicitFinish();
+
+  await pushPref("devtools.recordreplay.enableRewinding", false);
+
+  let recordingFile = newRecordingFile();
+  let recordingTab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });
+  gBrowser.selectedTab = recordingTab;
+  openTrustedLinkIn(EXAMPLE_URL + "doc_rr_basic.html", "current");
+  await once(Services.ppmm, "RecordingFinished");
+
+  let tabParent = recordingTab.linkedBrowser.frameLoader.tabParent;
+  ok(tabParent, "Found recording tab parent");
+  ok(tabParent.saveRecording(recordingFile), "Saved recording");
+  await once(Services.ppmm, "SaveRecordingFinished");
+
+  let replayingTab = BrowserTestUtils.addTab(gBrowser, null, { replayExecution: recordingFile });
+  gBrowser.selectedTab = replayingTab;
+  await once(Services.ppmm, "HitRecordingEndpoint");
+
+  ok(true, "Replayed to end of recording");
+
+  await gBrowser.removeTab(recordingTab);
+  await gBrowser.removeTab(replayingTab);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/examples/doc_rr_recovery.html
@@ -0,0 +1,26 @@
+<html lang="en" dir="ltr">
+<body>
+<div id="maindiv">Hello World!</div>
+</body>
+<script>
+// this line intentionally left blank
+// this line intentionally left blank
+// this line intentionally left blank
+const cpmm = SpecialPowers.Services.cpmm;
+var number = 0;
+function f() {
+  updateNumber();
+  if (number >= 10) {
+    cpmm.sendAsyncMessage("RecordingFinished");
+    return;
+  }
+  window.setTimeout(f, 1);
+}
+function updateNumber() {
+  number++;
+  document.getElementById("maindiv").innerHTML = "Number: " + number;
+  SpecialPowers.Cu.recordReplayDirective(/* MaybeCrash */ 2);
+}
+window.setTimeout(f, 1);
+</script>
+</html>