RESOLVED FIXED 86621
Web Inspector: Copy ... actions in the context menu don't work in the remote debugging mode.
https://bugs.webkit.org/show_bug.cgi?id=86621
Summary Web Inspector: Copy ... actions in the context menu don't work in the remote ...
Mikhail Naganov
Reported 2012-05-16 06:48:48 PDT
Programmatic access to clipboard is disabled by default. For Chrome, this can be solved by installing a simple extension like this one: http://pastebin.com/kDxUacJd We also need to support copying in InspectorFrontendHostStub.
Attachments
Patch (5.04 KB, patch)
2012-05-16 06:50 PDT, Mikhail Naganov
mnaganov: commit-queue-
Comments addressed (5.03 KB, patch)
2012-05-16 07:02 PDT, Mikhail Naganov
pfeldman: review-
mnaganov: commit-queue-
Comments addressed (6.26 KB, patch)
2012-05-16 08:36 PDT, Mikhail Naganov
pfeldman: review-
mnaganov: commit-queue-
Comments addressed (7.32 KB, patch)
2012-05-17 04:42 PDT, Mikhail Naganov
pfeldman: review+
mnaganov: commit-queue-
Mikhail Naganov
Comment 1 2012-05-16 06:50:56 PDT
Alexander Pavlov (apavlov)
Comment 2 2012-05-16 06:56:14 PDT
Comment on attachment 142244 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=142244&action=review You don't seem to have added a corresponding localizedStrings.js entry for the message. > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:117 > + event.clipboardData.setData('text', this._textToCopy); We use double-quotes around strings in the frontend. > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:121 > + } else { We don't use braces around one-line blocks > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:129 > + if (!document.execCommand('copy')) { We use double-quotes around strings in the frontend. > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:206 > + p.textContent = WebInspector.UIString("You need to install \"Chrome Developer Tools Frontend\" Chrome extension."); Missing "the"? "...install the \"Chrome....."
Mikhail Naganov
Comment 3 2012-05-16 07:02:01 PDT
Comment on attachment 142244 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=142244&action=review >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:117 >> + event.clipboardData.setData('text', this._textToCopy); > > We use double-quotes around strings in the frontend. Done. >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:121 >> + } else { > > We don't use braces around one-line blocks Sorry, I was thinking they need to be symmetrical for both if branches. Removed. >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:129 >> + if (!document.execCommand('copy')) { > > We use double-quotes around strings in the frontend. Done. >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:206 >> + p.textContent = WebInspector.UIString("You need to install \"Chrome Developer Tools Frontend\" Chrome extension."); > > Missing "the"? "...install the \"Chrome....." Added, thanks!
Mikhail Naganov
Comment 4 2012-05-16 07:02:51 PDT
Created attachment 142250 [details] Comments addressed I will add strings to localizedStrings once we agree on wording.
Peter Beverloo
Comment 5 2012-05-16 07:09:28 PDT
Comment on attachment 142250 [details] Comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=142250&action=review > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:205 > + p.textContent = WebInspector.UIString("You need to install the \"Chrome Developer Tools Frontend\" Chrome extension."); Since this code is in WebCore, it probably shouldn't be referring to specific products (in this case, Chrome)?
Pavel Feldman
Comment 6 2012-05-16 07:42:06 PDT
Comment on attachment 142250 [details] Comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=142250&action=review > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:114 > + documentCopy: function(event) Why do you override this document's copy? >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:205 >> + p.textContent = WebInspector.UIString("You need to install the \"Chrome Developer Tools Frontend\" Chrome extension."); > > Since this code is in WebCore, it probably shouldn't be referring to specific products (in this case, Chrome)? This code should be in WebKit/chromium/src/js/DevTools.js. Who is going to own this extension? Could it be more generic (i.e. "Clipboard access enabler"?) Or we could combine it with the Chrome extension used for filesystem persistence. I would not want to see a separate "Chrome Developer Tools Front-end" as an extension.
Mikhail Naganov
Comment 7 2012-05-16 08:36:13 PDT
Comment on attachment 142250 [details] Comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=142250&action=review >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:114 >> + documentCopy: function(event) > > Why do you override this document's copy? We need to get the Event instance passed to the copy command handler in order to set clipboardData. I've changed the code insert FrontendHost's action after the event has been processed by the default documentCopy handler. >>> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:205 >>> + p.textContent = WebInspector.UIString("You need to install the \"Chrome Developer Tools Frontend\" Chrome extension."); >> >> Since this code is in WebCore, it probably shouldn't be referring to specific products (in this case, Chrome)? > > This code should be in WebKit/chromium/src/js/DevTools.js. Who is going to own this extension? Could it be more generic (i.e. "Clipboard access enabler"?) Or we could combine it with the Chrome extension used for filesystem persistence. I would not want to see a separate "Chrome Developer Tools Front-end" as an extension. Moved platform-specific code to DevTools.js The extension (in fact, this is a simple Web App) specifies the starting URL (localhost:9222), adds clipboard access permissions, and specifies the frontend hosting URL as the App's URL. I've posted a link to the sample already, have you seen it? http://pastebin.com/kDxUacJd Do you already have the extension used for filesystem persistence? Can you please point me to it?
Mikhail Naganov
Comment 8 2012-05-16 08:36:40 PDT
Created attachment 142270 [details] Comments addressed
Pavel Feldman
Comment 9 2012-05-16 08:48:07 PDT
> We need to get the Event instance passed to the copy command handler in order to set clipboardData. I've changed the code insert FrontendHost's action after the event has been processed by the default documentCopy handler. You can only use event object while it is being dispatched. Storing it is not right. > The extension (in fact, this is a simple Web App) specifies the starting URL (localhost:9222), adds clipboard access permissions, and specifies the frontend hosting URL as the App's URL. I've posted a link to the sample already, have you seen it? http://pastebin.com/kDxUacJd Nope, now that I've seen it, name slearly looks wrong ("Chrome Developer Tools Frontend"). You probably want to point to a wiki describing how to enable copy / paste or something. > Do you already have the extension used for filesystem persistence? Can you please point me to it? https://github.com/NV/chrome-devtools-autosave, http://code.google.com/p/devtools-save/,
Pavel Feldman
Comment 10 2012-05-16 08:49:40 PDT
Comment on attachment 142270 [details] Comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=142270&action=review > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:116 > + if (!this._textToCopy) I still don't understand what is happening here... > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:195 > +function clipboardAccessDeniedMessage() { { on the next line. You should not declare top-level functions.
Pavel Feldman
Comment 11 2012-05-16 09:00:37 PDT
Comment on attachment 142270 [details] Comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=142270&action=review > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:120 > + this._textToCopy = null; delete this._textToCopy. > Source/WebKit/chromium/src/js/DevTools.js:60 > + return "You need to install the \"Chrome Developer Tools Frontend\" Chrome extension."; You need to install Chrome extension that allows clipboard access for this page.
Mikhail Naganov
Comment 12 2012-05-17 04:42:20 PDT
Comment on attachment 142270 [details] Comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=142270&action=review >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:116 >> + if (!this._textToCopy) > > I still don't understand what is happening here... Discussed offline. >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:120 >> + this._textToCopy = null; > > delete this._textToCopy. Done. >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:195 >> +function clipboardAccessDeniedMessage() { > > { on the next line. You should not declare top-level functions. Done. >> Source/WebKit/chromium/src/js/DevTools.js:60 >> + return "You need to install the \"Chrome Developer Tools Frontend\" Chrome extension."; > > You need to install Chrome extension that allows clipboard access for this page. Done.
Mikhail Naganov
Comment 13 2012-05-17 04:42:59 PDT
Created attachment 142452 [details] Comments addressed
Yury Semikhatsky
Comment 14 2012-05-17 07:35:33 PDT
Comment on attachment 142452 [details] Comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=142452&action=review > Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:216 > +} Please remove this.
Mikhail Naganov
Comment 15 2012-05-17 12:04:51 PDT
Comment on attachment 142452 [details] Comments addressed View in context: https://bugs.webkit.org/attachment.cgi?id=142452&action=review >> Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js:216 >> +} > > Please remove this. What do you mean by "this"? The bracket is a closing for the one in the beginning of the file: "if (!window.InspectorFrontendHost) {". It's the highlighting that is a bit misguiding.
Mikhail Naganov
Comment 16 2012-05-17 12:38:42 PDT
Note You need to log in before you can comment on or make changes to this bug.