Title: [125860] trunk
Revision
125860
Author
[email protected]
Date
2012-08-16 23:15:48 -0700 (Thu, 16 Aug 2012)

Log Message

Web Inspector: Snippet script mapping should not load snippets until workspace reset event is dispatched on scripts panel.
https://bugs.webkit.org/show_bug.cgi?id=94218

Reviewed by Pavel Feldman.

Source/WebCore:

Scripts panel does not load uiSourceCodes in workspace reset handler anymore.
Snippet script mapping does not start reloading snippets after reset until WorkspaceReset event is dispatched.

* inspector/front-end/_javascript_SourceFrame.js: Simplified isComittingEditing to be reset synchronously.
(WebInspector._javascript_SourceFrame.prototype.commitEditing):
(WebInspector._javascript_SourceFrame.prototype._didEditContent):
* inspector/front-end/ScriptSnippetModel.js:
(WebInspector.ScriptSnippetModel.prototype._reset):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._uiSourceCodeAdded):
(WebInspector.ScriptsPanel.prototype._addUISourceCode):
(WebInspector.ScriptsPanel.prototype._reset):
* inspector/front-end/UISourceCodeFrame.js: Simplified isComittingEditing to be reset synchronously.
(WebInspector.UISourceCodeFrame.prototype.commitEditing):
(WebInspector.UISourceCodeFrame.prototype._didEditContent):

LayoutTests:

* http/tests/inspector/debugger-test.js:
(initialize_DebuggerTest):
* inspector/debugger/script-snippet-model-expected.txt:
* inspector/debugger/script-snippet-model.html: added a check that snippet uiSourceCode is correctly recreated after workspace reset.
* inspector/debugger/scripts-panel-expected.txt:
* inspector/debugger/scripts-panel.html:
* platform/chromium/inspector/debugger/script-snippet-model-expected.txt: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125859 => 125860)


--- trunk/LayoutTests/ChangeLog	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/LayoutTests/ChangeLog	2012-08-17 06:15:48 UTC (rev 125860)
@@ -1,3 +1,18 @@
+2012-08-16  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Snippet script mapping should not load snippets until workspace reset event is dispatched on scripts panel.
+        https://bugs.webkit.org/show_bug.cgi?id=94218
+
+        Reviewed by Pavel Feldman.
+
+        * http/tests/inspector/debugger-test.js:
+        (initialize_DebuggerTest):
+        * inspector/debugger/script-snippet-model-expected.txt:
+        * inspector/debugger/script-snippet-model.html: added a check that snippet uiSourceCode is correctly recreated after workspace reset.
+        * inspector/debugger/scripts-panel-expected.txt:
+        * inspector/debugger/scripts-panel.html:
+        * platform/chromium/inspector/debugger/script-snippet-model-expected.txt: Removed.
+
 2012-08-16  Yoshifumi Inoue  <[email protected]>
 
         [Tests] time-multiple-fields-appearance-basic.html and time-multiple-fields-appearance-pseudo-elements.html are failed on Chromium Windows

Modified: trunk/LayoutTests/http/tests/inspector/debugger-test.js (125859 => 125860)


--- trunk/LayoutTests/http/tests/inspector/debugger-test.js	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/LayoutTests/http/tests/inspector/debugger-test.js	2012-08-17 06:15:48 UTC (rev 125860)
@@ -158,8 +158,9 @@
     }
 };
 
-InspectorTest.showScriptSourceOnScriptsPanel = function(panel, scriptName, callback)
+InspectorTest.showScriptSource = function(scriptName, callback)
 {
+    var panel = WebInspector.panels.scripts;
     var uiSourceCodes = panel._workspace.uiSourceCodes();
     for (var i = 0; i < uiSourceCodes.length; ++i) {
         if (uiSourceCodes[i].parsedURL.lastPathComponent === scriptName) {
@@ -172,12 +173,8 @@
             return;
         }
     }
-    InspectorTest.addSniffer(panel, "_addUISourceCode", InspectorTest.showScriptSource.bind(InspectorTest, scriptName, callback));
-};
 
-InspectorTest.showScriptSource = function(scriptName, callback)
-{
-    InspectorTest.showScriptSourceOnScriptsPanel(WebInspector.panels.scripts, scriptName, callback)
+    InspectorTest.addSniffer(WebInspector.ScriptsPanel.prototype, "_addUISourceCode", InspectorTest.showScriptSource.bind(InspectorTest, scriptName, callback));
 };
 
 InspectorTest.dumpScriptsNavigator = function(navigator)

Modified: trunk/LayoutTests/inspector/debugger/script-snippet-model-expected.txt (125859 => 125860)


--- trunk/LayoutTests/inspector/debugger/script-snippet-model-expected.txt	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/LayoutTests/inspector/debugger/script-snippet-model-expected.txt	2012-08-17 06:15:48 UTC (rev 125860)
@@ -2,6 +2,11 @@
 
 Debugger was enabled.
 
+Running: testWorkspaceReset
+Snippet created.
+Resetting snippet script mapping.
+Snippet uiSourceCode was recreated.
+
 Running: testEvaluate
 Last evaluation source url for snippet: snippets:///1_1
 Snippet script added, sourceURL = snippets:///1_1

Modified: trunk/LayoutTests/inspector/debugger/script-snippet-model.html (125859 => 125860)


--- trunk/LayoutTests/inspector/debugger/script-snippet-model.html	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/LayoutTests/inspector/debugger/script-snippet-model.html	2012-08-17 06:15:48 UTC (rev 125860)
@@ -17,6 +17,29 @@
     WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel();
 
     InspectorTest.runDebuggerTestSuite([
+        function testWorkspaceReset(next)
+        {
+            resetSnippetsSettings();
+            var snippetJavaScriptSource = WebInspector.scriptSnippetModel.createScriptSnippet();
+            var snippetName = "TestSnippet" + Math.random();
+            InspectorTest.addResult("Snippet created.");
+            WebInspector.scriptSnippetModel.renameScriptSnippet(snippetJavaScriptSource, snippetName);
+            WebInspector.scriptSnippetModel.scriptMapping.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCodeAdded);
+            InspectorTest.addResult("Resetting snippet script mapping.");
+            WebInspector.scriptSnippetModel.scriptMapping.reset();
+            InspectorTest.assertTrue(!WebInspector.scriptSnippetModel.scriptMapping.uiSourceCodes().length, "Snippets script mapping should not have any uiSourceCodea after reset.");
+
+            function uiSourceCodeAdded(event)
+            {
+                var uiSourceCode = event.data;
+                if (uiSourceCode.url.indexOf(snippetName) === -1)
+                    return;
+                InspectorTest.addResult("Snippet uiSourceCode was recreated.");
+                WebInspector.workspace.removeEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCodeAdded);
+                next();
+            }
+        },
+
         function testEvaluate(next)
         {
             resetSnippetsSettings();
@@ -32,8 +55,7 @@
             WebInspector.scriptSnippetModel.renameScriptSnippet(snippetJavaScriptSource2, "Snippet2");
             content = "";
             content += "// This snippet creates a function that does nothing and returns it.\n";
-            content += "function doesNothing()\n";
-            content += "{\n";
+            content += "function doesNothing() {\n";
             content += "    var  i = 2+2;\n";
             content += "};\n";
             content += "doesNothing;\n";

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt (125859 => 125860)


--- trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2012-08-17 06:15:48 UTC (rev 125860)
@@ -6,7 +6,6 @@
   bar.js
   baz.js
   foo.js
-  foobar.js
 Dumping ScriptsNavigator 'Content scripts' tab:
 Source requested for baz.js
 

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (125859 => 125860)


--- trunk/LayoutTests/inspector/debugger/scripts-panel.html	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html	2012-08-17 06:15:48 UTC (rev 125860)
@@ -37,8 +37,11 @@
         }
         provider._reset = function(preservedItems)
         {
-            uiSourceCodes = preservedItems || [];
+            uiSourceCodes = [];
             this.dispatchEventToListeners(WebInspector.Workspace.Events.WorkspaceReset, null);
+
+            for (var i = 0; i < preservedItems.length; ++i)
+                this._addUISourceCode(preservedItems[i]);
         }
         provider._replaceUISourceCode = function(oldUISourceCode, uiSourceCode)
         {

Deleted: trunk/LayoutTests/platform/chromium/inspector/debugger/script-snippet-model-expected.txt (125859 => 125860)


--- trunk/LayoutTests/platform/chromium/inspector/debugger/script-snippet-model-expected.txt	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/LayoutTests/platform/chromium/inspector/debugger/script-snippet-model-expected.txt	2012-08-17 06:15:48 UTC (rev 125860)
@@ -1,19 +0,0 @@
-Tests script snippet model.
-
-Debugger was enabled.
-
-Running: testEvaluate
-Last evaluation source url for snippet: snippets:///1_1
-Snippet script added, sourceURL = snippets:///1_1
-Snippet execution result: undefined
-Last evaluation source url for snippet: snippets:///2_2
-Snippet script added, sourceURL = snippets:///2_2
-Snippet execution result: function doesNothing()
-{
-    var  i = 2+2;
-}
-Last evaluation source url for snippet: snippets:///1_3
-Snippet script added, sourceURL = snippets:///1_3
-Snippet execution result: undefined
-Debugger was disabled.
-

Modified: trunk/Source/WebCore/ChangeLog (125859 => 125860)


--- trunk/Source/WebCore/ChangeLog	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/Source/WebCore/ChangeLog	2012-08-17 06:15:48 UTC (rev 125860)
@@ -1,3 +1,26 @@
+2012-08-16  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Snippet script mapping should not load snippets until workspace reset event is dispatched on scripts panel.
+        https://bugs.webkit.org/show_bug.cgi?id=94218
+
+        Reviewed by Pavel Feldman.
+
+        Scripts panel does not load uiSourceCodes in workspace reset handler anymore.
+        Snippet script mapping does not start reloading snippets after reset until WorkspaceReset event is dispatched.
+
+        * inspector/front-end/_javascript_SourceFrame.js: Simplified isComittingEditing to be reset synchronously.
+        (WebInspector._javascript_SourceFrame.prototype.commitEditing):
+        (WebInspector._javascript_SourceFrame.prototype._didEditContent):
+        * inspector/front-end/ScriptSnippetModel.js:
+        (WebInspector.ScriptSnippetModel.prototype._reset):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._uiSourceCodeAdded):
+        (WebInspector.ScriptsPanel.prototype._addUISourceCode):
+        (WebInspector.ScriptsPanel.prototype._reset):
+        * inspector/front-end/UISourceCodeFrame.js: Simplified isComittingEditing to be reset synchronously.
+        (WebInspector.UISourceCodeFrame.prototype.commitEditing):
+        (WebInspector.UISourceCodeFrame.prototype._didEditContent):
+
 2012-08-16  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r125829.

Modified: trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js (125859 => 125860)


--- trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/Source/WebCore/inspector/front-end/AdvancedSearchController.js	2012-08-17 06:15:48 UTC (rev 125860)
@@ -222,6 +222,8 @@
 WebInspector.SearchView.maxQueriesCount = 20;
 
 WebInspector.SearchView.prototype = {
+    __proto__: WebInspector.View.prototype,
+
     /**
      * @return {Array.<Element>}
      */
@@ -388,7 +390,7 @@
     }
 }
 
-WebInspector.SearchView.prototype.__proto__ = WebInspector.View.prototype;
+//WebInspector.SearchView.prototype.__proto__ = WebInspector.View.prototype;
 
 /**
  * @constructor

Modified: trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js (125859 => 125860)


--- trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js	2012-08-17 06:15:48 UTC (rev 125860)
@@ -93,6 +93,7 @@
 
         this._isCommittingEditing = true;
         this._javaScriptSource.commitWorkingCopy(this._didEditContent.bind(this));
+        delete this._isCommittingEditing;
     },
 
     /**
@@ -158,8 +159,6 @@
 
     _didEditContent: function(error)
     {
-        delete this._isCommittingEditing;
-
         if (error) {
             WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
             return;

Modified: trunk/Source/WebCore/inspector/front-end/ScriptSnippetModel.js (125859 => 125860)


--- trunk/Source/WebCore/inspector/front-end/ScriptSnippetModel.js	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/Source/WebCore/inspector/front-end/ScriptSnippetModel.js	2012-08-17 06:15:48 UTC (rev 125860)
@@ -364,7 +364,8 @@
         var removedUISourceCodes = this._releasedUISourceCodes();
         this._uiSourceCodeForScriptId = {};
         this._scriptForUISourceCode = new Map();
-        this._loadSnippets();
+        this._snippetJavaScriptSourceForSnippetId = {};
+        setTimeout(this._loadSnippets.bind(this), 0);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (125859 => 125860)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-08-17 06:15:48 UTC (rev 125860)
@@ -168,7 +168,7 @@
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ExecutionLineChanged, this._executionLineChanged, this);
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this);
 
-    this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this);
+    this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this);
     this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
     this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
     this._workspace.addEventListener(WebInspector.Workspace.Events.WorkspaceReset, this._reset.bind(this, false), this);
@@ -227,26 +227,9 @@
     /**
      * @param {WebInspector.Event} event
      */
-    _handleUISourceCodeAdded: function(event)
+    _uiSourceCodeAdded: function(event)
     {
         var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data;
-        if (this._toggleFormatSourceButton.toggled)
-            uiSourceCode.setFormatted(true);
-        this._uiSourceCodeAdded(uiSourceCode);
-    },
-
-    _loadUISourceCodes: function()
-    {
-        var uiSourceCodes = this._workspace.uiSourceCodes();
-        for (var i = 0; i < uiSourceCodes.length; ++i)
-            this._uiSourceCodeAdded(uiSourceCodes[i]);
-    },
-
-    /**
-     * @param {WebInspector.UISourceCode} uiSourceCode
-     */
-    _uiSourceCodeAdded: function(uiSourceCode)
-    {
         this._addUISourceCode(uiSourceCode);
     },
 
@@ -255,6 +238,9 @@
      */
     _addUISourceCode: function(uiSourceCode)
     {
+        if (this._toggleFormatSourceButton.toggled)
+            uiSourceCode.setFormatted(true);
+
         this._navigator.addUISourceCode(uiSourceCode);
         this._editorContainer.addUISourceCode(uiSourceCode);
     },
@@ -367,8 +353,6 @@
         var uiSourceCodes = this._workspace.uiSourceCodes();
         for (var i = 0; i < uiSourceCodes.length; ++i)
             this._removeSourceFrame(uiSourceCodes[i]);
-
-        this._loadUISourceCodes();
     },
 
     get visibleView()

Modified: trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js (125859 => 125860)


--- trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js	2012-08-17 06:10:32 UTC (rev 125859)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCodeFrame.js	2012-08-17 06:15:48 UTC (rev 125860)
@@ -57,6 +57,7 @@
 
         this._isCommittingEditing = true;
         this._uiSourceCode.commitWorkingCopy(this._didEditContent.bind(this));
+        delete this._isCommittingEditing;
     },
 
     onTextChanged: function(oldRange, newRange)
@@ -70,7 +71,6 @@
             WebInspector.log(error, WebInspector.ConsoleMessage.MessageLevel.Error, true);
             return;
         }
-        delete this._isCommittingEditing;
     },
 
     /**
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to