mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1580104 - Wait for recording to initialize before loading URLs, r=jlast.
Differential Revision: https://phabricator.services.mozilla.com/D49090 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
8a7bc2ad4e
commit
5be1c5612c
@ -44,8 +44,11 @@ function ReloadAndRecordTab() {
|
||||
newFrameloader: true,
|
||||
remoteType: E10SUtils.DEFAULT_REMOTE_TYPE,
|
||||
});
|
||||
gBrowser.loadURI(url, {
|
||||
triggeringPrincipal: gBrowser.selectedBrowser.contentPrincipal,
|
||||
Services.ppmm.addMessageListener("RecordingInitialized", function listener() {
|
||||
Services.ppmm.removeMessageListener("RecordingInitialized", listener);
|
||||
gBrowser.loadURI(url, {
|
||||
triggeringPrincipal: gBrowser.selectedBrowser.contentPrincipal,
|
||||
});
|
||||
});
|
||||
Services.telemetry.scalarAdd("devtools.webreplay.reload_recording", 1);
|
||||
}
|
||||
|
@ -6,11 +6,7 @@
|
||||
|
||||
// Test basic recording of a tab without any debugging.
|
||||
add_task(async function() {
|
||||
const recordingTab = BrowserTestUtils.addTab(gBrowser, null, {
|
||||
recordExecution: "*",
|
||||
});
|
||||
gBrowser.selectedTab = recordingTab;
|
||||
openTrustedLinkIn(EXAMPLE_URL + "doc_rr_basic.html", "current");
|
||||
const recordingTab = await openRecordingTab("doc_rr_basic.html");
|
||||
await once(Services.ppmm, "RecordingFinished");
|
||||
|
||||
await gBrowser.removeTab(recordingTab);
|
||||
|
@ -7,11 +7,7 @@
|
||||
// Basic test for saving a recording and then replaying it in a new tab.
|
||||
add_task(async function() {
|
||||
const recordingFile = newRecordingFile();
|
||||
const recordingTab = BrowserTestUtils.addTab(gBrowser, null, {
|
||||
recordExecution: "*",
|
||||
});
|
||||
gBrowser.selectedTab = recordingTab;
|
||||
openTrustedLinkIn(EXAMPLE_URL + "doc_rr_basic.html", "current");
|
||||
const recordingTab = await openRecordingTab("doc_rr_basic.html");
|
||||
await once(Services.ppmm, "RecordingFinished");
|
||||
|
||||
const remoteTab = recordingTab.linkedBrowser.frameLoader.remoteTab;
|
||||
|
@ -9,11 +9,7 @@ add_task(async function() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
const recordingFile = newRecordingFile();
|
||||
const recordingTab = BrowserTestUtils.addTab(gBrowser, null, {
|
||||
recordExecution: "*",
|
||||
});
|
||||
gBrowser.selectedTab = recordingTab;
|
||||
openTrustedLinkIn(EXAMPLE_URL + "doc_rr_continuous.html", "current");
|
||||
const recordingTab = await openRecordingTab("doc_rr_continuous.html");
|
||||
|
||||
let dbg = await attachDebugger(recordingTab);
|
||||
|
||||
|
@ -10,11 +10,7 @@ add_task(async function() {
|
||||
await pushPref("devtools.recordreplay.enableRewinding", false);
|
||||
|
||||
const recordingFile = newRecordingFile();
|
||||
const recordingTab = BrowserTestUtils.addTab(gBrowser, null, {
|
||||
recordExecution: "*",
|
||||
});
|
||||
gBrowser.selectedTab = recordingTab;
|
||||
openTrustedLinkIn(EXAMPLE_URL + "doc_rr_basic.html", "current");
|
||||
const recordingTab = await openRecordingTab("doc_rr_basic.html");
|
||||
await once(Services.ppmm, "RecordingFinished");
|
||||
|
||||
const remoteTab = recordingTab.linkedBrowser.frameLoader.remoteTab;
|
||||
|
@ -27,6 +27,14 @@ async function attachDebugger(tab) {
|
||||
return { ...dbg, tab, threadFront };
|
||||
}
|
||||
|
||||
async function openRecordingTab(url) {
|
||||
const tab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });
|
||||
gBrowser.selectedTab = tab;
|
||||
await once(Services.ppmm, "RecordingInitialized");
|
||||
openTrustedLinkIn(EXAMPLE_URL + url, "current");
|
||||
return tab;
|
||||
}
|
||||
|
||||
async function attachRecordingDebugger(
|
||||
url,
|
||||
{ waitForRecording, disableLogging, skipInterrupt } = {}
|
||||
@ -35,9 +43,7 @@ async function attachRecordingDebugger(
|
||||
await pushPref("devtools.recordreplay.logging", true);
|
||||
}
|
||||
|
||||
const tab = BrowserTestUtils.addTab(gBrowser, null, { recordExecution: "*" });
|
||||
gBrowser.selectedTab = tab;
|
||||
openTrustedLinkIn(EXAMPLE_URL + url, "current");
|
||||
const tab = await openRecordingTab(url);
|
||||
|
||||
if (waitForRecording) {
|
||||
await once(Services.ppmm, "RecordingFinished");
|
||||
|
@ -80,6 +80,18 @@ dbg.onNewGlobalObject = function(global) {
|
||||
}
|
||||
};
|
||||
|
||||
// If we are recording, we need to notify the UI process when the content global
|
||||
// has been initialized in this process, which will allow URLs to be loaded.
|
||||
Services.obs.addObserver(
|
||||
{
|
||||
observe(subject, topic, data) {
|
||||
assert(topic == "content-document-global-created");
|
||||
Services.cpmm.sendAsyncMessage("RecordingInitialized");
|
||||
},
|
||||
},
|
||||
"content-document-global-created"
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Utilities
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user