Bug 143939 - Web Inspector: assertion failure when editing inline styles
Summary: Web Inspector: assertion failure when editing inline styles
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-04-19 16:53 PDT by Tobias Reiss
Modified: 2015-04-25 09:31 PDT (History)
8 users (show)

See Also:


Attachments
patch (4.82 KB, patch)
2015-04-19 17:25 PDT, Tobias Reiss
no flags Details | Formatted Diff | Diff
patch (4.88 KB, patch)
2015-04-25 07:27 PDT, Tobias Reiss
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Reiss 2015-04-19 16:53:41 PDT
Editing inline styles causes a cascade of procedures ending in `fetchedStyleSheetContent` which expects the CSSStyleSheet to have a valid URL. This is never the case since inline styles neither have a "sourceURL" nor a "parent frame". Actually it looks like using the `CSSStyleSheet` class for inline styles is not what http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-htmlelementcss-h3 specifies.
Comment 1 Radar WebKit Bug Importer 2015-04-19 16:53:50 PDT
<rdar://problem/20608788>
Comment 2 Tobias Reiss 2015-04-19 17:25:34 PDT
Created attachment 251139 [details]
patch
Comment 3 Tobias Reiss 2015-04-19 17:32:07 PDT
Comment on attachment 251139 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=251139&action=review

> Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js:-28
> -    constructor(id, url, parentFrame)

This change is not directly related to the bugfix. It turned out that "url" and "parentFrame" are never passed to the constructor.

> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:572
> +        if (type === WebInspector.CSSStyleDeclaration.Type.Attribute)

This fixes a linter error.
Comment 4 Timothy Hatcher 2015-04-24 12:30:55 PDT
Comment on attachment 251139 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=251139&action=review

Looks good! Make these tweaks and I can r+ this.

> Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js:134
> +        if (styleSheet.isCssInlineStyle)

See below. This will need to change to: styleSheet.isInlineStyle()

> Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js:87
> +    get isCssInlineStyle()

CSS should be all caps. No XMLHttpRequest precedent here. I don't think repeating CSS is needed either.

We also don't use is for getters. This should be a function.

I'd go with: isInlineStyle()

> Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js:92
> +    markAsCssInlineStyle()

Ditto. Go with: markAsInlineStyle().
Comment 5 Tobias Reiss 2015-04-25 07:27:06 PDT
Created attachment 251637 [details]
patch
Comment 6 Tobias Reiss 2015-04-25 07:36:27 PDT
Looking at the Changelog the "webkit-patch" script for some reasons generated the following:
- "WebInspector.CSSStyleSheet.isInlineStyle" (not on prototype)
- "WebInspector.CSSStyleSheet.prototype.markAsInlineStyle" (on prototype)

But both functions are actually supposed to be on the prototype.
Comment 7 Timothy Hatcher 2015-04-25 08:42:09 PDT
Comment on attachment 251637 [details]
patch

Nice!
Comment 8 WebKit Commit Bot 2015-04-25 09:31:10 PDT
Comment on attachment 251637 [details]
patch

Clearing flags on attachment: 251637

Committed r183311: <http://trac.webkit.org/changeset/183311>
Comment 9 WebKit Commit Bot 2015-04-25 09:31:15 PDT
All reviewed patches have been landed.  Closing bug.