Bug 67647

Summary: Web Inspector: do not re-create RawSourceCode when toggling pretty-print mode.
Product: WebKit Reporter: Pavel Podivilov <podivilov>
Component: Web Inspector (Deprecated)Assignee: Pavel Podivilov <podivilov>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, dglazkov, eric, joepeck, keishi, loislo, pfeldman, pmuellr, rik, rniwa, timothy, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 67754    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch yurys: review+

Description Pavel Podivilov 2011-09-06 08:37:08 PDT
Web Inspector: do not re-create RawSourceCode when toggling pretty-print mode.

* implement RawSourceCode.setFormatted that allows toggling pretty-print mode on the fly without recreating everything
* add RawSourceCode unit tests
* remove source mapping listeners and console messages from presentation model
Comment 1 Pavel Podivilov 2011-09-06 08:38:59 PDT
Created attachment 106423 [details]
Patch
Comment 2 WebKit Review Bot 2011-09-06 08:40:40 PDT
Attachment 106423 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/update-webkit', '--chromium']" exit_code: 2

Last 3072 characters of output:
://src.chromium.org/svn/trunk/src/media@99393
    parsed_url: http://src.chromium.org/svn/trunk/src/media@99393
    should_process: True
    processed: True
    requirements: set(['./'])
  
    name: build
    url: http://src.chromium.org/svn/trunk/src/build@99393
    parsed_url: http://src.chromium.org/svn/trunk/src/build@99393
    should_process: True
    processed: True
    requirements: set(['./'])
  
    name: net
    url: http://src.chromium.org/svn/trunk/src/net@99393
    should_process: True
    requirements: set(['./'])
  
    name: tools/data_pack
    url: http://src.chromium.org/svn/trunk/src/tools/data_pack@99393
    should_process: True
    requirements: set(['./'])
  
    name: third_party/ffmpeg
    url: From('chromium_deps', 'src/third_party/ffmpeg')
    should_process: True
    requirements: set(['third_party', 'chromium_deps', './'])
  
    name: tools/generate_stubs
    url: http://src.chromium.org/svn/trunk/src/tools/generate_stubs@99393
    should_process: True
    requirements: set(['./'])
  
    name: third_party/libjpeg_turbo
    url: From('chromium_deps', 'src/third_party/libjpeg_turbo')
    should_process: True
    requirements: set(['third_party', 'chromium_deps', './'])
  
    name: third_party/v8-i18n
    url: From('chromium_deps', 'src/third_party/v8-i18n')
    should_process: True
    requirements: set(['third_party', 'chromium_deps', './'])
  
    name: tools/grit
    url: http://src.chromium.org/svn/trunk/src/tools/grit@99393
    should_process: True
    requirements: set(['./'])
  
    name: base
    url: http://src.chromium.org/svn/trunk/src/base@99393
    should_process: True
    requirements: set(['./'])
  
    name: sql
    url: http://src.chromium.org/svn/trunk/src/sql@99393
    should_process: True
    requirements: set(['./'])
  
    name: v8
    url: From('chromium_deps', 'src/v8')
    should_process: True
    requirements: set(['chromium_deps', './'])
  
    name: testing/gtest
    url: From('chromium_deps', 'src/testing/gtest')
    should_process: True
    requirements: set(['testing', 'chromium_deps', './'])
  
    name: third_party/libwebp
    url: http://src.chromium.org/svn/trunk/src/third_party/libwebp@99393
    should_process: True
    requirements: set(['third_party', './'])
  
    name: googleurl
    url: From('chromium_deps', 'src/googleurl')
    should_process: True
    requirements: set(['chromium_deps', './'])
  
    name: third_party/skia/include
    url: From('chromium_deps', 'src/third_party/skia/include')
    should_process: True
    requirements: set(['third_party', 'chromium_deps', './'])
  
    name: third_party/ots
    url: From('chromium_deps', 'src/third_party/ots')
    should_process: True
    requirements: set(['third_party', 'chromium_deps', './'])
  
    name: third_party/snappy/src
    url: From('chromium_deps', 'src/third_party/snappy/src')
    should_process: True
    requirements: set(['third_party', 'chromium_deps', './'])

Died at Tools/Scripts/update-webkit-chromium line 80.
No such file or directory at Tools/Scripts/update-webkit line 104.


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 WebKit Review Bot 2011-09-06 08:42:51 PDT
Comment on attachment 106423 [details]
Patch

Attachment 106423 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/9590989
Comment 4 Yury Semikhatsky 2011-09-07 04:53:40 PDT
Comment on attachment 106423 [details]
Patch

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

> LayoutTests/inspector/debugger/raw-source-code.html:9
> +    var sourceMapping = {

Can this test be split into a few smaller ones?

> LayoutTests/inspector/debugger/raw-source-code.html:83
> +        var timerId = originalSetTimeout(invokeCallback, timeout)

It should be originalSetTimeout.call(window,...)

> LayoutTests/inspector/debugger/raw-source-code.html:93
> +        for (var i = 0; i < 3; ++i) {

Why do you do it exactly thrice? Should it loop until timers is empty? If you assume that firing timers may modify "timers" map it should be cloned before the iteration.

> LayoutTests/inspector/debugger/raw-source-code.html:105
> +            var script = createScript("foo.js", [0, 0, 20, 80], true, "<script source>");

Here and below script content and start/end line/column should be in sync, otherwise the test uses invalid scripts. r- for this.
Comment 5 Pavel Podivilov 2011-09-07 05:34:33 PDT
Created attachment 106575 [details]
Patch
Comment 6 Yury Semikhatsky 2011-09-07 05:39:57 PDT
Comment on attachment 106575 [details]
Patch

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

> LayoutTests/inspector/debugger/raw-source-code.html:9
> +    function createScriptMock(url, range, isContentScript, source)

Can this method derive end coordinates from the start and source?
Comment 7 Pavel Podivilov 2011-09-07 05:40:55 PDT
(In reply to comment #4)
> (From update of attachment 106423 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=106423&action=review
> 
> > LayoutTests/inspector/debugger/raw-source-code.html:9
> > +    var sourceMapping = {
> 
> Can this test be split into a few smaller ones?

This is a set of unit tests for a single class, I think it's nice to have them defined in the same file. Also, it's faster than loading multiple test documents.

> 
> > LayoutTests/inspector/debugger/raw-source-code.html:83
> > +        var timerId = originalSetTimeout(invokeCallback, timeout)
> 
> It should be originalSetTimeout.call(window,...)

Done.

> 
> > LayoutTests/inspector/debugger/raw-source-code.html:93
> > +        for (var i = 0; i < 3; ++i) {
> 
> Why do you do it exactly thrice? Should it loop until timers is empty? If you assume that firing timers may modify "timers" map it should be cloned before the iteration.

I don't want this test to start timing out if there is a setTimeout chain somewhere.
Three times is just enough for the test purpose, and there shouldn't be any problems with it.
Keys list is cloned by VM, no need to do it manually (items added during enumeration are guaranteed not to be visited.

> 
> > LayoutTests/inspector/debugger/raw-source-code.html:105
> > +            var script = createScript("foo.js", [0, 0, 20, 80], true, "<script source>");
> 
> Here and below script content and start/end line/column should be in sync, otherwise the test uses invalid scripts. r- for this.

Done.
Comment 8 Pavel Podivilov 2011-09-07 05:48:40 PDT
Created attachment 106576 [details]
Patch
Comment 9 Yury Semikhatsky 2011-09-07 06:30:28 PDT
Comment on attachment 106576 [details]
Patch

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

> LayoutTests/inspector/debugger/raw-source-code.html:96
> +    function fireTimers()

Are there real setTimeout chains that can't be handled with listeners/sniffers like in other inspector tests? We don't intervene in the timer in other tests I don't see why we should here.
Comment 10 Yury Semikhatsky 2011-09-07 06:31:10 PDT
(In reply to comment #7)
> (In reply to comment #4)
> > (From update of attachment 106423 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=106423&action=review
> Keys list is cloned by VM, no need to do it manually (items added during enumeration are guaranteed not to be visited.
> 
Good to know.
Comment 11 Pavel Podivilov 2011-09-07 08:20:57 PDT
(In reply to comment #9)
> (From update of attachment 106576 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=106576&action=review
> 
> > LayoutTests/inspector/debugger/raw-source-code.html:96
> > +    function fireTimers()
> 
> Are there real setTimeout chains that can't be handled with listeners/sniffers like in other inspector tests? We don't intervene in the timer in other tests I don't see why we should here.

Removed use of timers from RawSourceCode._createSourceMapping and the test.
Comment 12 Pavel Podivilov 2011-09-07 08:22:25 PDT
Created attachment 106586 [details]
Patch
Comment 13 Pavel Podivilov 2011-09-07 09:41:24 PDT
Committed r94674: <http://trac.webkit.org/changeset/94674>
Comment 14 Ryosuke Niwa 2011-09-07 10:43:54 PDT
inspector/debugger/script-formatter.html is failing on Qt after this patch:
http://build.webkit.org/results/Qt%20Linux%20Release/r94677%20(37240)/results.html
Comment 20 Ryosuke Niwa 2011-09-07 19:57:07 PDT
I'm going to rollout the patch for now since I don't understand what the test is testing or what this change is about, and nobody appears to be actively working on it.
Comment 21 Pavel Podivilov 2011-09-08 08:04:52 PDT
Committed r94760: <http://trac.webkit.org/changeset/94760>