Bug 60163

Summary: Web Inspector: fix incremental html highlight.
Product: WebKit Reporter: Pavel Podivilov <podivilov>
Component: Web Inspector (Deprecated)Assignee: Pavel Podivilov <podivilov>
Status: RESOLVED FIXED    
Severity: Normal CC: aandrey, aandrey, apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch.
none
Patch.
abarth: review-
Patch.
none
Patch. yurys: review+

Description Pavel Podivilov 2011-05-04 05:59:04 PDT
Web Inspector: fix incremental html highlight.

SourceHTMLTokenizer is declared to be stateless, however it uses _internalJavaScriptTokenizer and _internalCSSTokenizer fields as a part of its state.
This makes incremental highlighting impossible, since SourceHTMLTokenizer state can not be fully restored from stringified state used by highlighter.
Comment 1 Pavel Podivilov 2011-05-04 06:00:04 PDT
Created attachment 92224 [details]
Patch.
Comment 2 Andrey Adaikin 2011-05-04 06:05:27 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=92224&action=review

> Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js:149
> +        return WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript");

wrong MIME type

> Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js:148
> +        return WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript");

same
Comment 3 Andrey Adaikin 2011-05-04 06:06:56 PDT
I did not work with this code very closely, so you'll probably want to wait for somebody else's review :)
Comment 4 Pavel Podivilov 2011-05-04 06:13:14 PDT
Created attachment 92228 [details]
Patch.
Comment 5 Adam Barth 2011-05-06 01:15:48 PDT
Comment on attachment 92228 [details]
Patch.

This patch causes many tests failures:


  inspector/console/command-line-api-inspect.html = TEXT
  inspector/debugger/debugger-breakpoints-not-activated-on-reload.html = TEXT
  inspector/debugger/debugger-cyclic-ref.html = TEXT
  inspector/debugger/debugger-eval-on-call-frame.html = TEXT

Regressions: Unexpected tests timed out : (14)
  http/tests/appcache/remove-cache.html = TIMEOUT
  http/tests/inspector/inspect-iframe-from-different-domain.html = TIMEOUT
  http/tests/inspector/network/download.html = TIMEOUT
  inspector/console/command-line-api.html = TIMEOUT
  inspector/console/console-api-on-call-frame.html = TIMEOUT
  inspector/console/console-assert.html = TIMEOUT
  inspector/console/console-clear.html = TIMEOUT
  inspector/console/console-command-clear.html = TIMEOUT
  inspector/console/console-dir-global.html = TIMEOUT
  inspector/debugger/debugger-eval-while-paused.html = TIMEOUT
  inspector/debugger/debugger-expand-scope.html = TIMEOUT
  inspector/debugger/debugger-no-nested-pause.html = TIMEOUT
  inspector/debugger/debugger-pause-in-eval-script.html = TIMEOUT
  inspector/debugger/debugger-pause-on-breakpoint.html = TIMEOUT
Comment 6 Pavel Podivilov 2011-05-06 02:25:19 PDT
Created attachment 92565 [details]
Patch.

Also fix the bug with tokenizer.initialCondition being modified after tokenizer.condition = tokenizer.initialCondition.
Comment 7 Yury Semikhatsky 2011-05-06 02:44:16 PDT
Comment on attachment 92565 [details]
Patch.

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

> Source/WebCore/inspector/front-end/SourceCSSTokenizer.js:125
> +    get initialCondition()

As initialCondition now returns new object on each call it would make sense to rename it to createInitialCondition.
Comment 8 Pavel Podivilov 2011-05-06 03:16:50 PDT
Created attachment 92566 [details]
Patch.

get initialCondition -> createInitialCondition
Comment 9 Pavel Podivilov 2011-05-13 08:30:35 PDT
Committed r86430: <http://trac.webkit.org/changeset/86430>