Bug 147721

Summary: Web Inspector: Cached external stylesheets do not (re)output parser warnings for stylesheet to console
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: graouts, inspector-bugzilla-changes, koivisto, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Joseph Pecoraro
Reported 2015-08-05 21:29:07 PDT
* SUMMARY Cached external stylesheets do not (re)output parser warnings for stylesheet to console. * STEPS TO REPRODUCE 1. Inspect inspector-protocol/console/css-source-locations.html via http => console warnings for external stylesheet errors.css and inline style 2. Reload => console warnings for just inline style * NOTES - When errors.css was cached the warnings are not output in the new page load - HTMLLinkElement::setCSSStyleSheet has a block of code that seems to re-use a cachable sheet, and doesn't re-parse it, without re-parsing (parseAuthorStyleSheet) it the warnings are not re-logged to the console > void HTMLLinkElement::setCSSStyleSheet(const String& href, const URL& baseURL, const String& charset, const CachedCSSStyleSheet* cachedStyleSheet) > { > ... > if (RefPtr<StyleSheetContents> restoredSheet = const_cast<CachedCSSStyleSheet*>(cachedStyleSheet)->restoreParsedStyleSheet(parserContext, cachePolicy)) { > ... > m_loading = false; > sheetLoaded(); > notifyLoadedSheetAndAllCriticalSubresources(false); > return; > } > ... > styleSheet.get().parseAuthorStyleSheet(cachedStyleSheet, document().securityOrigin()); > ... > }
Attachments
Joseph Pecoraro
Comment 1 2015-08-05 21:35:59 PDT
User impact is that if the resource was cached (and restored by this path) then the user will never see parser warnings if they open the stylesheet and view in Web Inspector. If they opened the same resource when it was not cached (in this way) they see the warnings inline.
Antti Koivisto
Comment 2 2015-08-06 01:42:57 PDT
I suppose the right approach here depends what the inspector intention is. Should it accurately report what happens during the page load? We don't parse the sheet if it is cached so there are no parse errors. Or should it show maximum amount of information about the page resources?
Blaze Burg
Comment 3 2015-08-06 09:35:55 PDT
(In reply to comment #2) > I suppose the right approach here depends what the inspector intention is. > Should it accurately report what happens during the page load? We don't > parse the sheet if it is cached so there are no parse errors. Or should it > show maximum amount of information about the page resources? IMO, not reparsing is a performance optimization that should not be surfaced. I think the Inspector should show the same parse errors, whether or not the resource was cached- this is what happens for other cached resources that have syntax errors, like JS. The inspector does not currently show whether the stylesheet was reparsed or not. (In fact, it gets reparsed by the inspector many times, but this is transparent.) Joe and I had to dig into WebCore and use breakpoints to get some ground truth on whether something was reparsed.
David Kilzer (:ddkilzer)
Comment 4 2016-09-09 11:54:23 PDT
Note You need to log in before you can comment on or make changes to this bug.