Bug 171569 - REGRESSION (r215630): Web Inspector: Option-Click on URL in Styles sidebar does not work
Summary: REGRESSION (r215630): Web Inspector: Option-Click on URL in Styles sidebar do...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL: https://webkit.org/
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-05-02 14:02 PDT by Nikita Vasilyev
Modified: 2017-05-03 18:39 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.84 KB, patch)
2017-05-03 17:57 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2017-05-02 14:02:36 PDT
-------
Inspected URL:        https://webkit.org/
Loading completed:    true
Frontend User Agent:  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/604.1.21+ (KHTML, like Gecko)

Uncaught Exceptions:
 - TypeError: frame.resourceForURL is not a function. (In 'frame.resourceForURL(simplifiedURL, searchChildFrames)', 'frame.resourceForURL' is undefined) (at Main.js:856:91)
    openURL @ Main.js:856:91
    tokenTrackingControllerHighlightedRangeWasClicked @ CSSStyleDeclarationTextEditor.js:1717:33
    _mouseButtonWasReleasedOverEditor @ CodeMirrorTokenTrackingController.js:425:89
    handleEvent @ CodeMirrorTokenTrackingController.js:253:51
-------

* STEPS TO REPRODUCE
1. Open https://webkit.org/.
2. Inspect the WebKit logo in top left corner (h1.logo).
3. In the Styles sidebar, find "background-image: url('images/webkit.svg');" and option-click on the image URL.

* EXPECTED
Image opens in the Resources tab.
Comment 1 Radar WebKit Bug Importer 2017-05-02 14:02:51 PDT
<rdar://problem/31946367>
Comment 2 Devin Rousso 2017-05-02 19:56:23 PDT
I think this regressed in r215630 <https://webkit.org/b/168709>.  It looks like I forgot the `frame` parameter of `WebInspector.openURL` in CSSStyleDeclarationTextEditor.js:1717.  It should be:

        // Special case option-clicking url(...) links.
        if (token && /\blink\b/.test(token.type)) {
            let url = token.string;
            let baseURL = sourceCodeLocation ? sourceCodeLocation.sourceCode.url : this._style.node.ownerDocument.documentURL;

            const frame = null;
            WebInspector.openURL(absoluteURL(url, baseURL), frame, options);
            return;
        }
Comment 3 Nikita Vasilyev 2017-05-03 15:00:28 PDT
I confirm it regressed in https://trac.webkit.org/changeset/215630/webkit.
Comment 4 Nikita Vasilyev 2017-05-03 15:06:17 PDT
(In reply to Devin Rousso from comment #2)
> I think this regressed in r215630 <https://webkit.org/b/168709>.  It looks
> like I forgot the `frame` parameter of `WebInspector.openURL` in
> CSSStyleDeclarationTextEditor.js:1717.  It should be:
> 
>         // Special case option-clicking url(...) links.
>         if (token && /\blink\b/.test(token.type)) {
>             let url = token.string;
>             let baseURL = sourceCodeLocation ?
> sourceCodeLocation.sourceCode.url :
> this._style.node.ownerDocument.documentURL;
> 
>             const frame = null;
>             WebInspector.openURL(absoluteURL(url, baseURL), frame, options);
>             return;
>         }

Yes, this solves the problem. Since you just wrote the fix, do you want to post a patch?
Comment 5 Devin Rousso 2017-05-03 17:57:27 PDT
Created attachment 308994 [details]
Patch
Comment 6 Joseph Pecoraro 2017-05-03 18:18:17 PDT
Comment on attachment 308994 [details]
Patch

r=me
Comment 7 WebKit Commit Bot 2017-05-03 18:39:49 PDT
Comment on attachment 308994 [details]
Patch

Clearing flags on attachment: 308994

Committed r216166: <http://trac.webkit.org/changeset/216166>
Comment 8 WebKit Commit Bot 2017-05-03 18:39:50 PDT
All reviewed patches have been landed.  Closing bug.