Bug 1495342 - Add 'Reload and Record Tab' menu item and functionality, r=jlast.

--HG--
extra : rebase_source : d8c053278ec3d50367f63219e51cf178b8decf7a
This commit is contained in:
Brian Hackett 2018-10-01 09:42:50 -10:00
Родитель 2ff1490550
Коммит c27c10805b
3 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -1554,6 +1554,7 @@ window._gBrowser = {
opener,
remoteType,
sameProcessAsFrameLoader,
recordExecution,
} = {}) {
let isRemote = aBrowser.getAttribute("remote") == "true";
@ -1627,6 +1628,14 @@ window._gBrowser = {
aBrowser.removeAttribute("remoteType");
}
if (recordExecution) {
aBrowser.setAttribute("recordExecution", recordExecution);
// Web Replay middleman processes need the default URL to be loaded in
// order to set up their rendering state.
aBrowser.setAttribute("nodefaultsrc", "false");
}
// NB: This works with the hack in the browser constructor that
// turns this normal property into a field.
if (sameProcessAsFrameLoader) {

Просмотреть файл

@ -46,6 +46,7 @@ webide.accesskey = W
devtoolsWebReplay.label = Web Replay
devtoolsRecordNewTab.label = Open New Recording Tab
devtoolsReloadAndRecordTab.label = Reload and Record Tab
devtoolsSaveRecording.label = Save Recording
devtoolsReplayNewTab.label = Load Recording in New Tab

Просмотреть файл

@ -23,6 +23,16 @@ function RecordNewTab() {
gBrowser.selectedTab = gBrowser.addWebTab("about:blank", { recordExecution: "*" });
}
function ReloadAndRecordTab() {
const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
const url = gBrowser.currentURI.spec;
gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true,
{ recordExecution: "*", newFrameloader: true });
gBrowser.loadURI(url, {
triggeringPrincipal: gBrowser.selectedBrowser.contentPrincipal,
});
}
function SaveRecording() {
const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser");
const fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
@ -52,6 +62,7 @@ function ReplayNewTab() {
const menuItems = [
{ id: "devtoolsRecordNewTab", command: RecordNewTab },
{ id: "devtoolsReloadAndRecordTab", command: ReloadAndRecordTab },
{ id: "devtoolsSaveRecording", command: SaveRecording },
{ id: "devtoolsReplayNewTab", command: ReplayNewTab },
];