Bug 36530 - Web Inspector: Error when highlighting JavaScript with an invalid mime type
Summary: Web Inspector: Error when highlighting JavaScript with an invalid mime type
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-24 06:50 PDT by Alexander Pavlov (apavlov)
Modified: 2010-03-24 09:57 PDT (History)
7 users (show)

See Also:


Attachments
[PATCH] Proposed solution (3.99 KB, patch)
2010-03-24 07:53 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Extended solution to cover all scripts, styles, and documents (3.45 KB, patch)
2010-03-24 08:54 PDT, Alexander Pavlov (apavlov)
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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