Bug 36530

Summary: Web Inspector: Error when highlighting JavaScript with an invalid mime type
Product: WebKit Reporter: Alexander Pavlov (apavlov) <apavlov>
Component: Web Inspector (Deprecated)Assignee: Alexander Pavlov (apavlov) <apavlov>
Status: RESOLVED FIXED    
Severity: Normal CC: bweinstein, joepeck, keishi, pfeldman, pmuellr, rik, timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed solution
none
[PATCH] Extended solution to cover all scripts, styles, and documents pfeldman: review+

Description Alexander Pavlov (apavlov) 2010-03-24 06:50:14 PDT
- Bring up WebInspector on http://code.google.com/p/chromium/issues/list
- Open kibbles-1.3.1-comp.js in the Scripts panel
- Inspect the WebInspector

On Chromium, the console says that there was an attempt to read the property "lexCondition" of undefined in WebInspector.SourceTokenizer.prototype.getLexCondition()

The js-file mime type is reported as "application/empty" which causes the default parser to be used, even though the parsing has not been set up properly for that.
Comment 1 Alexander Pavlov (apavlov) 2010-03-24 07:53:59 PDT
Created attachment 51497 [details]
[PATCH] Proposed solution
Comment 2 Pavel Feldman 2010-03-24 08:08:45 PDT
Comment on attachment 51497 [details]
[PATCH] Proposed solution

+ if (resource.mimeTypeIsConsistentWithType())

If this thing returns true, we still might end up with no tokenizer. Should this code be moved to the SourceTokenizer where you could handle this case?
Comment 3 Alexander Pavlov (apavlov) 2010-03-24 08:54:48 PDT
Created attachment 51506 [details]
[PATCH] Extended solution to cover all scripts, styles, and documents
Comment 4 Alexander Pavlov (apavlov) 2010-03-24 09:57:31 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
        M       WebCore/ChangeLog
        M       WebCore/inspector/front-end/SourceTokenizer.js
        M       WebCore/inspector/front-end/SourceView.js
        M       WebCore/inspector/front-end/TextEditorHighlighter.js
Committed r56444