mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 889944 - Add "Open in New Tab" context menu item on resources; r=harth
This commit is contained in:
parent
3aed3e9b9c
commit
cdea73e968
@ -362,6 +362,17 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
||||
this.selectedItem = newItem;
|
||||
},
|
||||
|
||||
/**
|
||||
* Opens selected item in a new tab.
|
||||
*/
|
||||
openRequestInTab: function() {
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
let selected = this.selectedItem.attachment;
|
||||
|
||||
win.openUILinkIn(selected.url, "tab", { relatedToCurrent: true });
|
||||
},
|
||||
|
||||
/**
|
||||
* Copy the request url from the currently selected item.
|
||||
*/
|
||||
|
@ -20,6 +20,10 @@
|
||||
<popupset id="networkPopupSet">
|
||||
<menupopup id="network-request-popup"
|
||||
onpopupshowing="NetMonitorView.RequestsMenu._onContextShowing(event);">
|
||||
<menuitem id="request-menu-context-newtab"
|
||||
label="&netmonitorUI.context.newTab;"
|
||||
accesskey="&netmonitorUI.context.newTab.accesskey;"
|
||||
oncommand="NetMonitorView.RequestsMenu.openRequestInTab();"/>
|
||||
<menuitem id="request-menu-context-copy-url"
|
||||
label="&netmonitorUI.context.copyUrl;"
|
||||
accesskey="&netmonitorUI.context.copyUrl.accesskey;"
|
||||
|
@ -45,6 +45,7 @@ MOCHITEST_BROWSER_TESTS = \
|
||||
browser_net_resend.js \
|
||||
browser_net_req-resp-bodies.js \
|
||||
browser_net_copy_url.js \
|
||||
browser_net_open_request_in_tab.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests if Open in new tab works.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
|
||||
info("Starting test...");
|
||||
|
||||
let { NetMonitorView } = aMonitor.panelWin;
|
||||
let { RequestsMenu } = NetMonitorView;
|
||||
|
||||
RequestsMenu.lazyUpdate = false;
|
||||
|
||||
waitForNetworkEvents(aMonitor, 1).then(() => {
|
||||
let requestItem = RequestsMenu.getItemAtIndex(0);
|
||||
RequestsMenu.selectedItem = requestItem;
|
||||
|
||||
gBrowser.tabContainer.addEventListener("TabOpen",function onOpen(event){
|
||||
ok(true, "A new tab has been opened ");
|
||||
gBrowser.tabContainer.removeEventListener("TabOpen", onOpen, false);
|
||||
cleanUp();
|
||||
}, false);
|
||||
|
||||
RequestsMenu.openRequestInTab();
|
||||
});
|
||||
|
||||
aDebuggee.performRequests(1);
|
||||
function cleanUp(){
|
||||
teardown(aMonitor).then(() => {
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
@ -186,6 +186,16 @@
|
||||
- for the "Edit and Resend" menu item displayed in the context menu for a request -->
|
||||
<!ENTITY netmonitorUI.summary.editAndResend.accesskey "R">
|
||||
|
||||
<!-- LOCALIZATION NOTE (netmonitorUI.context.newTab): This is the label
|
||||
- for the Open in New Tab menu item displayed in the context menu of the
|
||||
- network container -->
|
||||
<!ENTITY netmonitorUI.context.newTab "Open in New Tab">
|
||||
|
||||
<!-- LOCALIZATION NOTE (netmonitorUI.context.newTab.accesskey): This is the access key
|
||||
- for the Open in New Tab menu item displayed in the context menu of the
|
||||
- network container -->
|
||||
<!ENTITY netmonitorUI.context.newTab.accesskey "O">
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerUI.custom.newRequest): This is the label displayed
|
||||
- as the title of the new custom request form -->
|
||||
<!ENTITY netmonitorUI.custom.newRequest "New Request">
|
||||
|
Loading…
Reference in New Issue
Block a user