RESOLVED FIXED95334
Web Inspector: the URL of worker inspector window sometimes is invalid
https://bugs.webkit.org/show_bug.cgi?id=95334
Summary Web Inspector: the URL of worker inspector window sometimes is invalid
Peter Wang
Reported 2012-08-29 05:27:06 PDT
It's caused by a defect of function "_openInspectorWindow" in "WorkerManager.js". Taking QT port as example, the "window.location.href" is "qrc://../inspector.html", so the url of popup inspector window is "qrc://../inspector.html&dedicatedWorkerId", it causes a problem. To insert a '?' can make it works, the right url is "qrc://../inspector.html?&dedicatedWorkerId".
Attachments
Patch (1.79 KB, patch)
2012-08-29 05:44 PDT, Peter Wang
no flags
Patch (1.72 KB, patch)
2012-08-29 06:23 PDT, Peter Wang
no flags
The description of the problem (89.49 KB, image/png)
2012-08-31 02:40 PDT, Peter Wang
no flags
Patch (1.77 KB, patch)
2012-08-31 03:22 PDT, Peter Wang
no flags
Patch (2.17 KB, patch)
2012-09-03 02:16 PDT, Peter Wang
no flags
Peter Wang
Comment 1 2012-08-29 05:44:39 PDT
Yury Semikhatsky
Comment 2 2012-08-29 06:04:32 PDT
Comment on attachment 161203 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=161203&action=review > Source/WebCore/inspector/front-end/WorkerManager.js:166 > + if (!search) This can be simplified: var url = window.location.href if (!search) url += "?"; url += "&dedicatedWorkerId=" + workerId;
Peter Wang
Comment 3 2012-08-29 06:23:53 PDT
Peter Wang
Comment 4 2012-08-29 06:24:08 PDT
(In reply to comment #2) > (From update of attachment 161203 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=161203&action=review > > > Source/WebCore/inspector/front-end/WorkerManager.js:166 > > + if (!search) > > This can be simplified: > var url = window.location.href > if (!search) > url += "?"; > url += "&dedicatedWorkerId=" + workerId; But, seems for Chromium the "window.location.href" have a '?'(In reply to comment #2) > (From update of attachment 161203 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=161203&action=review > > > Source/WebCore/inspector/front-end/WorkerManager.js:166 > > + if (!search) > > This can be simplified: > var url = window.location.href > if (!search) > url += "?"; > url += "&dedicatedWorkerId=" + workerId; sorry.
Peter Wang
Comment 5 2012-08-29 06:27:07 PDT
(In reply to comment #4) > (In reply to comment #2) > > (From update of attachment 161203 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=161203&action=review > > > > > Source/WebCore/inspector/front-end/WorkerManager.js:166 > > > + if (!search) > > > > This can be simplified: > > var url = window.location.href > > if (!search) > > url += "?"; > > url += "&dedicatedWorkerId=" + workerId; > > But, seems for Chromium the "window.location.href" have a '?'(In reply to comment #2) > > (From update of attachment 161203 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=161203&action=review > > > > > Source/WebCore/inspector/front-end/WorkerManager.js:166 > > > + if (!search) > > > > This can be simplified: > > var url = window.location.href > > if (!search) > > url += "?"; > > url += "&dedicatedWorkerId=" + workerId; > > sorry. sorry, this comment is submitted by a mistake. It should be ignored.
Pavel Feldman
Comment 6 2012-08-31 01:57:41 PDT
Comment on attachment 161210 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=161210&action=review > Source/WebCore/inspector/front-end/WorkerManager.js:168 > + url += "&dedicatedWorkerId=" + workerId; You don't need '&' to follow '?', right?
Peter Wang
Comment 7 2012-08-31 02:06:03 PDT
(In reply to comment #6) > (From update of attachment 161210 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=161210&action=review > > > Source/WebCore/inspector/front-end/WorkerManager.js:168 > > + url += "&dedicatedWorkerId=" + workerId; > > You don't need '&' to follow '?', right? No, I need "&dedicatedWorkerId" to indicate the parameter, but the "url" is not always ended with '?', and it will caused a invalid URL.
Peter Wang
Comment 8 2012-08-31 02:40:56 PDT
Created attachment 161646 [details] The description of the problem I've upload a picture as a description of this bug. Maybe it shows the problem more clearly.
Pavel Feldman
Comment 9 2012-08-31 02:45:58 PDT
I think I understand the problem clearly. But you code produces foo.com?&dedicatedWorkerId=... for "foo.com" href. It should produce foo.com?dedicatedWorkerId=...
Peter Wang
Comment 10 2012-08-31 03:22:15 PDT
Peter Wang
Comment 11 2012-08-31 03:25:18 PDT
(In reply to comment #9) > I think I understand the problem clearly. But you code produces > > foo.com?&dedicatedWorkerId=... > > for "foo.com" href. It should produce > > foo.com?dedicatedWorkerId=... Yes, it seems not good. Shame.
Pavel Feldman
Comment 12 2012-08-31 05:45:07 PDT
Comment on attachment 161650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=161650&action=review > Source/WebCore/inspector/front-end/WorkerManager.js:-164 > - var url = window.location.href + "&dedicatedWorkerId=" + workerId; var url = window.location.href + (window.location.search ? "&" : "?") + "dedicatedWorkerId=" + workerId; would keep it one liner.
Andrey Adaikin
Comment 13 2012-08-31 12:29:18 PDT
(In reply to comment #12) > (From update of attachment 161650 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=161650&action=review > > > Source/WebCore/inspector/front-end/WorkerManager.js:-164 > > - var url = window.location.href + "&dedicatedWorkerId=" + workerId; > > var url = window.location.href + (window.location.search ? "&" : "?") + "dedicatedWorkerId=" + workerId; > > would keep it one liner. FYI provided that window.location.hash is always empty
Pavel Feldman
Comment 14 2012-09-03 02:08:43 PDT
Comment on attachment 161650 [details] Patch Lets keep the code dense!
Peter Wang
Comment 15 2012-09-03 02:16:34 PDT
Peter Wang
Comment 16 2012-09-03 02:17:46 PDT
(In reply to comment #13) > (In reply to comment #12) > > (From update of attachment 161650 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=161650&action=review > > > > > Source/WebCore/inspector/front-end/WorkerManager.js:-164 > > > - var url = window.location.href + "&dedicatedWorkerId=" + workerId; > > > > var url = window.location.href + (window.location.search ? "&" : "?") + "dedicatedWorkerId=" + workerId; > > > > would keep it one liner. > > FYI > provided that window.location.hash is always empty Thx. Yes, window.location.hash is a problem.
Peter Wang
Comment 17 2012-09-03 02:27:50 PDT
(In reply to comment #15) > Created an attachment (id=161882) [details] > Patch So far (In reply to comment #14) > (From update of attachment 161650 [details]) > Lets keep the code dense! Ok.The newest patch can handle the situation if there is a "window.location.hash" in url.
Pavel Feldman
Comment 18 2012-09-03 06:23:48 PDT
Comment on attachment 161882 [details] Patch At some point we should make ParsedURL read-write so that one could patch query parameters and serialize it back.
Charles Wei
Comment 19 2012-09-03 19:04:53 PDT
Comment on attachment 161882 [details] Patch commit.
WebKit Review Bot
Comment 20 2012-09-03 19:09:20 PDT
Comment on attachment 161882 [details] Patch Clearing flags on attachment: 161882 Committed r127437: <http://trac.webkit.org/changeset/127437>
WebKit Review Bot
Comment 21 2012-09-03 19:09:24 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.