зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1465477 Part 1 - Add menu items and prefs for recording/replaying tabs, r=markh.
--HG-- extra : rebase_source : 23307266b2df128845df3ee9972fab240754019d
This commit is contained in:
Родитель
923cdafe51
Коммит
8f246a4b12
|
@ -518,6 +518,15 @@
|
|||
accesskey="&pageSourceCmd.accesskey;">
|
||||
<observes element="canViewSource" attribute="disabled"/>
|
||||
</menuitem>
|
||||
<menuitem id="menu_devtools_recordExecution"
|
||||
observes="devtoolsMenuBroadcaster_RecordExecution"
|
||||
hidden="true"/>
|
||||
<menuitem id="menu_devtools_saveRecording"
|
||||
observes="devtoolsMenuBroadcaster_SaveRecording"
|
||||
hidden="true"/>
|
||||
<menuitem id="menu_devtools_replayExecution"
|
||||
observes="devtoolsMenuBroadcaster_ReplayExecution"
|
||||
hidden="true"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem id="menu_pageInfo"
|
||||
|
|
|
@ -98,6 +98,9 @@
|
|||
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
|
||||
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
|
||||
<command id="Tools:Sanitize" oncommand="Sanitizer.showUI(window);"/>
|
||||
<command id="Tools:RecordExecution" oncommand="BeginRecordExecution()"/>
|
||||
<command id="Tools:SaveRecording" oncommand="SaveRecordedExecution()"/>
|
||||
<command id="Tools:ReplayExecution" oncommand="BeginReplayExecution()"/>
|
||||
<command id="Tools:PrivateBrowsing"
|
||||
oncommand="OpenBrowserWindow({private: true});"/>
|
||||
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
|
||||
|
@ -153,6 +156,15 @@
|
|||
sidebarurl="chrome://browser/content/syncedtabs/sidebar.xhtml"
|
||||
oncommand="SidebarUI.toggle('viewTabsSidebar');"/>
|
||||
<broadcaster id="workOfflineMenuitemState"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_RecordExecution"
|
||||
label="&devtoolsRecordExecution.label;"
|
||||
command="Tools:RecordExecution"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_SaveRecording"
|
||||
label="&devtoolsSaveRecording.label;"
|
||||
command="Tools:SaveRecording"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_ReplayExecution"
|
||||
label="&devtoolsReplayExecution.label;"
|
||||
command="Tools:ReplayExecution"/>
|
||||
</broadcasterset>
|
||||
|
||||
<keyset id="mainKeyset">
|
||||
|
|
|
@ -7124,6 +7124,35 @@ function BrowserOpenAddonsMgr(aView) {
|
|||
});
|
||||
}
|
||||
|
||||
function BeginRecordExecution() {
|
||||
gBrowser.selectedTab = gBrowser.addTab("about:blank", { recordExecution: "*" });
|
||||
}
|
||||
|
||||
function SaveRecordedExecution() {
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let window = gBrowser.ownerGlobal;
|
||||
fp.init(window, null, Ci.nsIFilePicker.modeSave);
|
||||
fp.open(rv => {
|
||||
if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
|
||||
var tabParent = gBrowser.selectedTab.linkedBrowser.frameLoader.tabParent;
|
||||
if (!tabParent || !tabParent.saveRecording(fp.file.path)) {
|
||||
window.alert("Current tab is not recording");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function BeginReplayExecution() {
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let window = gBrowser.ownerGlobal;
|
||||
fp.init(window, null, Ci.nsIFilePicker.modeOpen);
|
||||
fp.open(rv => {
|
||||
if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
|
||||
gBrowser.selectedTab = gBrowser.addTab(null, { replayExecution: fp.file.path });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function AddKeywordForSearchField() {
|
||||
let mm = gBrowser.selectedBrowser.messageManager;
|
||||
|
||||
|
|
|
@ -1778,7 +1778,8 @@ window._gBrowser = {
|
|||
_createBrowser(aParams) {
|
||||
// Supported parameters:
|
||||
// userContextId, remote, remoteType, isPreloadBrowser,
|
||||
// uriIsAboutBlank, sameProcessAsFrameLoader
|
||||
// uriIsAboutBlank, sameProcessAsFrameLoader,
|
||||
// recordExecution, replayExecution
|
||||
|
||||
let b = document.createElementNS(this._XUL_NS, "browser");
|
||||
b.permanentKey = {};
|
||||
|
@ -1801,6 +1802,16 @@ window._gBrowser = {
|
|||
b.setAttribute("remote", "true");
|
||||
}
|
||||
|
||||
let recordExecution = aParams && aParams.recordExecution;
|
||||
if (recordExecution) {
|
||||
b.setAttribute("recordExecution", recordExecution);
|
||||
}
|
||||
|
||||
let replayExecution = aParams && aParams.replayExecution;
|
||||
if (replayExecution) {
|
||||
b.setAttribute("replayExecution", replayExecution);
|
||||
}
|
||||
|
||||
if (aParams.openerWindow) {
|
||||
if (aParams.remoteType) {
|
||||
throw new Error("Cannot set opener window on a remote browser!");
|
||||
|
@ -2152,6 +2163,8 @@ window._gBrowser = {
|
|||
skipBackgroundNotify,
|
||||
triggeringPrincipal,
|
||||
userContextId,
|
||||
recordExecution,
|
||||
replayExecution,
|
||||
} = {}) {
|
||||
// if we're adding tabs, we're past interrupt mode, ditch the owner
|
||||
if (this.selectedTab.owner) {
|
||||
|
@ -2331,7 +2344,9 @@ window._gBrowser = {
|
|||
// icon for the tab would be set incorrectly (see bug 1195981).
|
||||
if (aURI == BROWSER_NEW_TAB_URL &&
|
||||
!userContextId &&
|
||||
!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||
!PrivateBrowsingUtils.isWindowPrivate(window) &&
|
||||
!recordExecution &&
|
||||
!replayExecution) {
|
||||
b = this._getPreloadedBrowser();
|
||||
if (b) {
|
||||
usingPreloadedContent = true;
|
||||
|
@ -2348,6 +2363,8 @@ window._gBrowser = {
|
|||
openerWindow: opener,
|
||||
nextTabParentId,
|
||||
name,
|
||||
recordExecution,
|
||||
replayExecution,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -312,6 +312,10 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
|||
<!ENTITY webDeveloperMenu.label "Web Developer">
|
||||
<!ENTITY webDeveloperMenu.accesskey "W">
|
||||
|
||||
<!ENTITY devtoolsRecordExecution.label "Record Execution">
|
||||
<!ENTITY devtoolsSaveRecording.label "Save Recording">
|
||||
<!ENTITY devtoolsReplayExecution.label "Replay Execution">
|
||||
|
||||
<!ENTITY inspectContextMenu.label "Inspect Element">
|
||||
<!ENTITY inspectContextMenu.accesskey "Q">
|
||||
|
||||
|
|
|
@ -113,6 +113,16 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
|||
|
||||
// Enable DevTools connection screen, if the preference allows this.
|
||||
toggleMenuItem("menu_devtools_connect", devtoolsRemoteEnabled);
|
||||
|
||||
// Enable record/replay menu items?
|
||||
try {
|
||||
const recordReplayEnabled = Services.prefs.getBoolPref("devtools.recordreplay.enabled");
|
||||
toggleMenuItem("menu_devtools_recordExecution", recordReplayEnabled);
|
||||
toggleMenuItem("menu_devtools_saveRecording", recordReplayEnabled);
|
||||
toggleMenuItem("menu_devtools_replayExecution", recordReplayEnabled);
|
||||
} catch (e) {
|
||||
// devtools.recordreplay.enabled only exists on certain platforms.
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1052,6 +1052,12 @@ pref("browser.dom.window.dump.enabled", true, sticky);
|
|||
// Controls whether EventEmitter module throws dump message on each emit
|
||||
pref("toolkit.dump.emit", false);
|
||||
|
||||
// Enable recording/replaying executions.
|
||||
#if defined(XP_MACOSX) && defined(NIGHTLY_BUILD)
|
||||
pref("devtools.recordreplay.enabled", false);
|
||||
pref("devtools.recordreplay.enableRewinding", true);
|
||||
#endif
|
||||
|
||||
// view source
|
||||
pref("view_source.syntax_highlight", true);
|
||||
pref("view_source.wrap_long_lines", false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче