Title: [129648] trunk
Revision
129648
Author
[email protected]
Date
2012-09-26 08:19:48 -0700 (Wed, 26 Sep 2012)

Log Message

Web Inspector: [REGRESSION] Revision support problems: revert and apply original content  cause exceptions
https://bugs.webkit.org/show_bug.cgi?id=97669

Reviewed by Pavel Feldman.

Source/WebCore:

Added missed callback parameters.

Test: inspector/uisourcecode-revisions.html

* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode.prototype.revertToOriginal):
(WebInspector.UISourceCode.prototype.revertAndClearHistory):

LayoutTests:

* inspector/uisourcecode-revisions-expected.txt: Added.
* inspector/uisourcecode-revisions.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129647 => 129648)


--- trunk/LayoutTests/ChangeLog	2012-09-26 15:17:36 UTC (rev 129647)
+++ trunk/LayoutTests/ChangeLog	2012-09-26 15:19:48 UTC (rev 129648)
@@ -1,3 +1,13 @@
+2012-09-26  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: [REGRESSION] Revision support problems: revert and apply original content  cause exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=97669
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/uisourcecode-revisions-expected.txt: Added.
+        * inspector/uisourcecode-revisions.html: Added.
+
 2012-09-26  Christophe Dumez  <[email protected]>
 
         [EFL] mediaControlsEflFullscreen.css overrides regular media controls styling

Added: trunk/LayoutTests/inspector/uisourcecode-revisions-expected.txt (0 => 129648)


--- trunk/LayoutTests/inspector/uisourcecode-revisions-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/uisourcecode-revisions-expected.txt	2012-09-26 15:19:48 UTC (rev 129648)
@@ -0,0 +1,79 @@
+Tests revision support in UISourceCode.
+
+Bug 97669
+
+Running: testAddRevisionsRevertToOriginal
+First revision added.
+UISourceCode content: content2
+    revisions: 'content2'
+Second revision added.
+UISourceCode content: content4
+    revisions: 'content2', 'content4'
+Reverted to original.
+UISourceCode content: <script content>
+    revisions: 'content2', 'content4', '<script content>'
+
+Running: testAddRevisionsRevertAndClearHistory
+First revision added.
+UISourceCode content: content2
+    revisions: 'content2'
+Second revision added.
+UISourceCode content: content4
+    revisions: 'content2', 'content4'
+Reverted and cleared history.
+UISourceCode content: <script content>
+    revisions: 
+
+Running: testAddRevisionsRevertToPrevious
+First revision added.
+UISourceCode content: content2
+    revisions: 'content2'
+Second revision added.
+UISourceCode content: content4
+    revisions: 'content2', 'content4'
+Reverted to previous revision.
+UISourceCode content: content2
+    revisions: 'content2', 'content4', 'content2'
+
+Running: testRequestContentAddRevisionsRevertToOriginal
+Content requested.
+UISourceCode content: <script content>
+    revisions: 
+First revision added.
+UISourceCode content: content2
+    revisions: 'content2'
+Second revision added.
+UISourceCode content: content4
+    revisions: 'content2', 'content4'
+Reverted to original.
+UISourceCode content: <script content>
+    revisions: 'content2', 'content4', '<script content>'
+
+Running: testRequestContentAddRevisionsRevertAndClearHistory
+Content requested.
+UISourceCode content: <script content>
+    revisions: 
+First revision added.
+UISourceCode content: content2
+    revisions: 'content2'
+Second revision added.
+UISourceCode content: content4
+    revisions: 'content2', 'content4'
+Reverted and cleared history.
+UISourceCode content: <script content>
+    revisions: 
+
+Running: testRequestContentAddRevisionsRevertToPrevious
+Content requested.
+UISourceCode content: <script content>
+    revisions: 
+First revision added.
+UISourceCode content: content2
+    revisions: 'content2'
+Second revision added.
+UISourceCode content: content4
+    revisions: 'content2', 'content4'
+Reverted to previous revision.
+UISourceCode content: content2
+    revisions: 'content2', 'content4', 'content2'
+
Property changes on: trunk/LayoutTests/inspector/uisourcecode-revisions-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/uisourcecode-revisions.html (0 => 129648)


--- trunk/LayoutTests/inspector/uisourcecode-revisions.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/uisourcecode-revisions.html	2012-09-26 15:19:48 UTC (rev 129648)
@@ -0,0 +1,195 @@
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+ setTimeout(InspectorTest.completeTest.bind(InspectorTest), 3000);
+    WebInspector.showPanel("scripts");
+
+    function createMockContentProvider()
+    {
+        var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "<script content>", "text/_javascript_");
+        return contentProvider;
+    }
+
+    function dumpUISourceCodeWithRevisions(uiSourceCode)
+    {
+        var content = uiSourceCode._content;
+        var revisionsString = "";
+        for (var i = 0; i < uiSourceCode.history.length; ++i) {
+            var revision = uiSourceCode.history[i];
+            if (i !== 0)
+                revisionsString += ", ";
+            revisionsString += "'" + revision.content + "'";
+        }
+        InspectorTest.addResult("UISourceCode content: " + content);
+        InspectorTest.addResult("    revisions: " + revisionsString);
+    }
+
+    InspectorTest.runTestSuite([
+        function testAddRevisionsRevertToOriginal(next)
+        {
+            var uiSourceCode = new WebInspector.UISourceCode("url", createMockContentProvider());
+            uiSourceCode.setWorkingCopy("content1");
+            uiSourceCode.setWorkingCopy("content2");
+            uiSourceCode.commitWorkingCopy(function() { });
+
+            InspectorTest.addResult("First revision added.");
+            dumpUISourceCodeWithRevisions(uiSourceCode);
+            uiSourceCode.setWorkingCopy("content3");
+            uiSourceCode.setWorkingCopy("content4");
+            uiSourceCode.commitWorkingCopy(function() { });
+
+            InspectorTest.addResult("Second revision added.");
+            dumpUISourceCodeWithRevisions(uiSourceCode);
+            uiSourceCode.revertToOriginal();
+            InspectorTest.addResult("Reverted to original.");
+            dumpUISourceCodeWithRevisions(uiSourceCode);
+            next();
+        },
+
+        function testAddRevisionsRevertAndClearHistory(next)
+        {
+            var uiSourceCode = new WebInspector.UISourceCode("url2", createMockContentProvider());
+
+            uiSourceCode.setWorkingCopy("content1");
+            uiSourceCode.setWorkingCopy("content2");
+            uiSourceCode.commitWorkingCopy(function() { });
+
+            InspectorTest.addResult("First revision added.");
+            dumpUISourceCodeWithRevisions(uiSourceCode);
+            uiSourceCode.setWorkingCopy("content3");
+            uiSourceCode.setWorkingCopy("content4");
+            uiSourceCode.commitWorkingCopy(function() { });
+
+            InspectorTest.addResult("Second revision added.");
+            dumpUISourceCodeWithRevisions(uiSourceCode);
+            uiSourceCode.revertAndClearHistory(revertedAndClearedHistory);
+
+            function revertedAndClearedHistory()
+            {
+                InspectorTest.addResult("Reverted and cleared history.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                next();
+            }
+        },
+
+        function testAddRevisionsRevertToPrevious(next)
+        {
+            var uiSourceCode = new WebInspector.UISourceCode("url3", createMockContentProvider());
+
+            uiSourceCode.setWorkingCopy("content1");
+            uiSourceCode.setWorkingCopy("content2");
+            uiSourceCode.commitWorkingCopy(function() { });
+
+            InspectorTest.addResult("First revision added.");
+            dumpUISourceCodeWithRevisions(uiSourceCode);
+            uiSourceCode.setWorkingCopy("content3");
+            uiSourceCode.setWorkingCopy("content4");
+            uiSourceCode.commitWorkingCopy(function() { });
+
+            InspectorTest.addResult("Second revision added.");
+            dumpUISourceCodeWithRevisions(uiSourceCode);
+            uiSourceCode.history[0].revertToThis();
+            InspectorTest.addResult("Reverted to previous revision.");
+            dumpUISourceCodeWithRevisions(uiSourceCode);
+            next();
+        },
+
+        function testRequestContentAddRevisionsRevertToOriginal(next)
+        {
+            var uiSourceCode = new WebInspector.UISourceCode("url4", createMockContentProvider());
+            uiSourceCode.requestContent(contentReceived);
+
+            function contentReceived()
+            {
+                InspectorTest.addResult("Content requested.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.setWorkingCopy("content1");
+                uiSourceCode.setWorkingCopy("content2");
+                uiSourceCode.commitWorkingCopy(function() { });
+
+                InspectorTest.addResult("First revision added.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.setWorkingCopy("content3");
+                uiSourceCode.setWorkingCopy("content4");
+                uiSourceCode.commitWorkingCopy(function() { });
+
+                InspectorTest.addResult("Second revision added.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.revertToOriginal();
+                InspectorTest.addResult("Reverted to original.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                next();
+            }
+        },
+
+        function testRequestContentAddRevisionsRevertAndClearHistory(next)
+        {
+            var uiSourceCode = new WebInspector.UISourceCode("url5", createMockContentProvider());
+            uiSourceCode.requestContent(contentReceived);
+
+            function contentReceived()
+            {
+                InspectorTest.addResult("Content requested.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.setWorkingCopy("content1");
+                uiSourceCode.setWorkingCopy("content2");
+                uiSourceCode.commitWorkingCopy(function() { });
+
+                InspectorTest.addResult("First revision added.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.setWorkingCopy("content3");
+                uiSourceCode.setWorkingCopy("content4");
+                uiSourceCode.commitWorkingCopy(function() { });
+
+                InspectorTest.addResult("Second revision added.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.revertAndClearHistory(revertedAndClearedHistory);
+
+                function revertedAndClearedHistory()
+                {
+                    InspectorTest.addResult("Reverted and cleared history.");
+                    dumpUISourceCodeWithRevisions(uiSourceCode);
+                    next();
+                }
+            }
+        },
+
+        function testRequestContentAddRevisionsRevertToPrevious(next)
+        {
+            var uiSourceCode = new WebInspector.UISourceCode("url6", createMockContentProvider());
+            uiSourceCode.requestContent(contentReceived);
+
+            function contentReceived()
+            {
+                InspectorTest.addResult("Content requested.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.setWorkingCopy("content1");
+                uiSourceCode.setWorkingCopy("content2");
+                uiSourceCode.commitWorkingCopy(function() { });
+
+                InspectorTest.addResult("First revision added.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.setWorkingCopy("content3");
+                uiSourceCode.setWorkingCopy("content4");
+                uiSourceCode.commitWorkingCopy(function() { });
+
+                InspectorTest.addResult("Second revision added.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                uiSourceCode.history[0].revertToThis();
+                InspectorTest.addResult("Reverted to previous revision.");
+                dumpUISourceCodeWithRevisions(uiSourceCode);
+                next();
+            }
+        },
+    ]);
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests revision support in UISourceCode.</p>
+<a href="" 97669</a>
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/uisourcecode-revisions.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (129647 => 129648)


--- trunk/Source/WebCore/ChangeLog	2012-09-26 15:17:36 UTC (rev 129647)
+++ trunk/Source/WebCore/ChangeLog	2012-09-26 15:19:48 UTC (rev 129648)
@@ -1,3 +1,18 @@
+2012-09-26  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: [REGRESSION] Revision support problems: revert and apply original content  cause exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=97669
+
+        Reviewed by Pavel Feldman.
+
+        Added missed callback parameters.
+
+        Test: inspector/uisourcecode-revisions.html
+
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UISourceCode.prototype.revertToOriginal):
+        (WebInspector.UISourceCode.prototype.revertAndClearHistory):
+
 2012-09-26  Kenneth Rohde Christiansen  <[email protected]>
 
         Reorder Qt WebCore includes

Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (129647 => 129648)


--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-09-26 15:17:36 UTC (rev 129647)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-09-26 15:19:48 UTC (rev 129648)
@@ -194,26 +194,42 @@
     revertToOriginal: function()
     {
         /**
+         * @this {WebInspector.UISourceCode}
          * @param {?string} content
          * @param {boolean} contentEncoded
          * @param {string} mimeType
          */
-      function callback(content, contentEncoded, mimeType)
+        function callback(content, contentEncoded, mimeType)
         {
-            this._setContent();
+            if (typeof content === "undefined")
+                return;
+
+            this._setContent(/** @type {string} */ content);
         }
 
         this.requestOriginalContent(callback.bind(this));
     },
 
+    /**
+     * @param {function(WebInspector.UISourceCode)} callback
+     */
     revertAndClearHistory: function(callback)
     {
-        function revert(content)
+        /**
+         * @this {WebInspector.UISourceCode}
+         * @param {?string} content
+         * @param {boolean} contentEncoded
+         * @param {string} mimeType
+         */
+        function revert(content, contentEncoded, mimeType)
         {
-            this._setContent(content);
+            if (typeof content === "undefined")
+                return;
+
+            this._setContent(/** @type {string} */ content);
             this._clearRevisionHistory();
             this.history = [];
-            callback();
+            callback(this);
         }
 
         this.requestOriginalContent(revert.bind(this));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to