Bug 162792

Summary: Inspector exception in `parseTextForRule()` when pasting into CSS rule selector
Product: WebKit Reporter: Rob Brackett <rob>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, hi, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Rob Brackett 2016-09-30 10:36:38 PDT
-------
Inspected URL:        http://localhost:8000/guides/anchor/index.html
Loading completed:    true
Frontend User Agent:  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.1.8+ (KHTML, like Gecko)

Uncaught Exceptions:
 - TypeError: null is not an object (evaluating 'parseTextForRule(data)') (at CSSStyleDeclarationSection.js:437:49)
    _handleSelectorPaste @ CSSStyleDeclarationSection.js:437:49
    _handleSelectorPaste @ [native code]
-------

* STEPS TO REPRODUCE
1. In the Elements panel, select an element with several CSS rules applying to it
2. In the Styles sidebar, select part of the selector for one of the rules and copy it (via keyboard, cmd+c)
3. Paste (via keyboard, cmd+v) the selected text at the start of a different selector
4. Inspector immediately flips to the "Web Inspector encountered an internal error" screen
Comment 1 Devin Rousso 2016-10-01 23:31:59 PDT
Created attachment 290463 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2016-10-01 23:32:09 PDT
<rdar://problem/28580248>
Comment 3 Matt Baker 2016-10-04 16:55:24 PDT
I can't reproduce this with the steps provided. Devin, do you have a reduction?
Comment 4 Devin Rousso 2016-10-05 14:27:56 PDT
(In reply to comment #3)
> I can't reproduce this with the steps provided. Devin, do you have a
> reduction?

The reproduction works just fine for me.  Either way, the logic still doesn't work correctly with strings that contain newlines.
Comment 5 Matt Baker 2016-10-06 15:51:20 PDT
Comment on attachment 290463 [details]
Patch

Was able to repro, r=me.
Comment 6 WebKit Commit Bot 2016-10-06 16:13:32 PDT
Comment on attachment 290463 [details]
Patch

Clearing flags on attachment: 290463

Committed r206888: <http://trac.webkit.org/changeset/206888>
Comment 7 WebKit Commit Bot 2016-10-06 16:13:35 PDT
All reviewed patches have been landed.  Closing bug.