Bug 1350235 - Move copy related menus into a sub-menu in netmonitor. r=gasolin, r=Honza
authorMichael Brennan <brennan.brisad@gmail.com>
Thu, 30 Mar 2017 04:45:00 -0400
changeset 351505 27dcd50df8572020c70d1472d5140460ecc3ae4d
parent 351504 6516ba9d875021c0604faf8d77ed582fb8c104d5
child 351506 840274759aba89d3989f29c0ded6ca49bfb9d377
push id31611
push usercbook@mozilla.com
push dateThu, 06 Apr 2017 10:51:05 +0000
treeherdermozilla-central@950612071c4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgasolin, Honza
bugs1350235
milestone55.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 1350235 - Move copy related menus into a sub-menu in netmonitor. r=gasolin, r=Honza
devtools/client/locales/en-US/netmonitor.properties
devtools/client/netmonitor/src/request-list-context-menu.js
--- a/devtools/client/locales/en-US/netmonitor.properties
+++ b/devtools/client/locales/en-US/netmonitor.properties
@@ -641,16 +641,24 @@ netmonitor.security.hpkp=Public Key Pinn
 # in the security tab describing the section containing information related to
 # the secure connection.
 netmonitor.security.connection=Connection:
 
 # LOCALIZATION NOTE (netmonitor.security.certificate): This is the label displayed
 # in the security tab describing the server certificate section.
 netmonitor.security.certificate=Certificate:
 
+# LOCALIZATION NOTE (netmonitor.context.copy): This is the label displayed
+# for the copy sub-menu in the context menu for a request
+netmonitor.context.copy=Copy
+
+# LOCALIZATION NOTE (netmonitor.context.copy.accesskey): This is the access key
+# for the copy sub-menu displayed in the context menu for a request
+netmonitor.context.copy.accesskey=C
+
 # LOCALIZATION NOTE (netmonitor.context.copyUrl): This is the label displayed
 # on the context menu that copies the selected request's url
 netmonitor.context.copyUrl=Copy URL
 
 # LOCALIZATION NOTE (netmonitor.context.copyUrl.accesskey): This is the access key
 # for the Copy URL menu item displayed in the context menu for a request
 netmonitor.context.copyUrl.accesskey=U
 
--- a/devtools/client/netmonitor/src/request-list-context-menu.js
+++ b/devtools/client/netmonitor/src/request-list-context-menu.js
@@ -45,104 +45,113 @@ RequestListContextMenu.prototype = {
    * Handle the context menu opening. Hide items if no request is selected.
    * Since visible attribute only accept boolean value but the method call may
    * return undefined, we use !! to force convert any object to boolean
    */
   open({ screenX = 0, screenY = 0 } = {}) {
     let selectedRequest = this.selectedRequest;
 
     let menu = new Menu();
-    menu.append(new MenuItem({
+    let copySubmenu = new Menu();
+
+    copySubmenu.append(new MenuItem({
       id: "request-list-context-copy-url",
       label: L10N.getStr("netmonitor.context.copyUrl"),
       accesskey: L10N.getStr("netmonitor.context.copyUrl.accesskey"),
       visible: !!selectedRequest,
       click: () => this.copyUrl(),
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       id: "request-list-context-copy-url-params",
       label: L10N.getStr("netmonitor.context.copyUrlParams"),
       accesskey: L10N.getStr("netmonitor.context.copyUrlParams.accesskey"),
       visible: !!(selectedRequest && getUrlQuery(selectedRequest.url)),
       click: () => this.copyUrlParams(),
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       id: "request-list-context-copy-post-data",
       label: L10N.getStr("netmonitor.context.copyPostData"),
       accesskey: L10N.getStr("netmonitor.context.copyPostData.accesskey"),
       visible: !!(selectedRequest && selectedRequest.requestPostData),
       click: () => this.copyPostData(),
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       id: "request-list-context-copy-as-curl",
       label: L10N.getStr("netmonitor.context.copyAsCurl"),
       accesskey: L10N.getStr("netmonitor.context.copyAsCurl.accesskey"),
       visible: !!selectedRequest,
       click: () => this.copyAsCurl(),
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       type: "separator",
       visible: !!selectedRequest,
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       id: "request-list-context-copy-request-headers",
       label: L10N.getStr("netmonitor.context.copyRequestHeaders"),
       accesskey: L10N.getStr("netmonitor.context.copyRequestHeaders.accesskey"),
       visible: !!(selectedRequest && selectedRequest.requestHeaders),
       click: () => this.copyRequestHeaders(),
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       id: "response-list-context-copy-response-headers",
       label: L10N.getStr("netmonitor.context.copyResponseHeaders"),
       accesskey: L10N.getStr("netmonitor.context.copyResponseHeaders.accesskey"),
       visible: !!(selectedRequest && selectedRequest.responseHeaders),
       click: () => this.copyResponseHeaders(),
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       id: "request-list-context-copy-response",
       label: L10N.getStr("netmonitor.context.copyResponse"),
       accesskey: L10N.getStr("netmonitor.context.copyResponse.accesskey"),
       visible: !!(selectedRequest &&
                selectedRequest.responseContent &&
                selectedRequest.responseContent.content.text &&
                selectedRequest.responseContent.content.text.length !== 0),
       click: () => this.copyResponse(),
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       id: "request-list-context-copy-image-as-data-uri",
       label: L10N.getStr("netmonitor.context.copyImageAsDataUri"),
       accesskey: L10N.getStr("netmonitor.context.copyImageAsDataUri.accesskey"),
       visible: !!(selectedRequest &&
                selectedRequest.responseContent &&
                selectedRequest.responseContent.content.mimeType.includes("image/")),
       click: () => this.copyImageAsDataUri(),
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       type: "separator",
       visible: !!selectedRequest,
     }));
 
-    menu.append(new MenuItem({
+    copySubmenu.append(new MenuItem({
       id: "request-list-context-copy-all-as-har",
       label: L10N.getStr("netmonitor.context.copyAllAsHar"),
       accesskey: L10N.getStr("netmonitor.context.copyAllAsHar.accesskey"),
       visible: this.sortedRequests.size > 0,
       click: () => this.copyAllAsHar(),
     }));
 
     menu.append(new MenuItem({
+      label: L10N.getStr("netmonitor.context.copy"),
+      accesskey: L10N.getStr("netmonitor.context.copy.accesskey"),
+      visible: !!selectedRequest,
+      submenu: copySubmenu,
+    }));
+
+    menu.append(new MenuItem({
       id: "request-list-context-save-all-as-har",
       label: L10N.getStr("netmonitor.context.saveAllAsHar"),
       accesskey: L10N.getStr("netmonitor.context.saveAllAsHar.accesskey"),
       visible: this.sortedRequests.size > 0,
       click: () => this.saveAllAsHar(),
     }));
 
     menu.append(new MenuItem({