Title: [94532] trunk/Source/WebCore
Revision
94532
Author
[email protected]
Date
2011-09-05 08:35:05 -0700 (Mon, 05 Sep 2011)

Log Message

Web Inspector: rename RawSourceCode.reload to contentEdited.
https://bugs.webkit.org/show_bug.cgi?id=67504

Make RawSourceCode.reload private and remove RawSourceCode.content getter and setter
(RawSourceCode isn't supposed to have any content).

Reviewed by Yury Semikhatsky.

* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel.prototype.setScriptSource.didEditScriptSource):
(WebInspector.DebuggerPresentationModel.prototype.setScriptSource):
(WebInspector.DebuggerPresentationModelResourceBinding.prototype.canSetContent):
(WebInspector.DebuggerPresentationModelResourceBinding.prototype.setContent):
(WebInspector.DebuggerPresentationModelResourceBinding.prototype._setContentWithInitialContent):
* inspector/front-end/SourceFile.js:
(WebInspector.RawSourceCode):
(WebInspector.RawSourceCode.prototype.contentEdited):
(WebInspector.RawSourceCode.prototype.forceLoadContent):
(WebInspector.RawSourceCode.prototype._reload):
(WebInspector.RawSourceCode.prototype._didRequestContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94531 => 94532)


--- trunk/Source/WebCore/ChangeLog	2011-09-05 15:01:59 UTC (rev 94531)
+++ trunk/Source/WebCore/ChangeLog	2011-09-05 15:35:05 UTC (rev 94532)
@@ -1,3 +1,26 @@
+2011-09-02  Pavel Podivilov  <[email protected]>
+
+        Web Inspector: rename RawSourceCode.reload to contentEdited.
+        https://bugs.webkit.org/show_bug.cgi?id=67504
+
+        Make RawSourceCode.reload private and remove RawSourceCode.content getter and setter
+        (RawSourceCode isn't supposed to have any content).
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel.prototype.setScriptSource.didEditScriptSource):
+        (WebInspector.DebuggerPresentationModel.prototype.setScriptSource):
+        (WebInspector.DebuggerPresentationModelResourceBinding.prototype.canSetContent):
+        (WebInspector.DebuggerPresentationModelResourceBinding.prototype.setContent):
+        (WebInspector.DebuggerPresentationModelResourceBinding.prototype._setContentWithInitialContent):
+        * inspector/front-end/SourceFile.js:
+        (WebInspector.RawSourceCode):
+        (WebInspector.RawSourceCode.prototype.contentEdited):
+        (WebInspector.RawSourceCode.prototype.forceLoadContent):
+        (WebInspector.RawSourceCode.prototype._reload):
+        (WebInspector.RawSourceCode.prototype._didRequestContent):
+
 2011-09-05  Leandro Gracia Gil  <[email protected]>
 
         Fix the regression of bug 65333 introduced by 60170.

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (94531 => 94532)


--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2011-09-05 15:01:59 UTC (rev 94531)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js	2011-09-05 15:35:05 UTC (rev 94532)
@@ -196,17 +196,17 @@
 
         function didEditScriptSource(error)
         {
-            if (!error) {
-                rawSourceCode.content = newSource;
+            callback(error);
+            if (error)
+                return;
 
-                var resource = WebInspector.resourceForURL(rawSourceCode.url);
-                if (resource)
-                    resource.addRevision(newSource);
-            }
+            var resource = WebInspector.resourceForURL(rawSourceCode.url);
+            if (resource)
+                resource.addRevision(newSource);
 
-            callback(error);
+            rawSourceCode.contentEdited();
 
-            if (!error && WebInspector.debuggerModel.callFrames)
+            if (WebInspector.debuggerModel.callFrames)
                 this._debuggerPaused();
         }
         WebInspector.debuggerModel.setScriptSource(script.scriptId, newSource, didEditScriptSource.bind(this));
@@ -542,7 +542,7 @@
         var rawSourceCode = this._presentationModel._rawSourceCodeForScript(resource.url)
         if (!rawSourceCode)
             return false;
-        return this._presentationModel.canEditScriptSource(rawSourceCode.id);
+        return this._presentationModel.canEditScriptSource(rawSourceCode.uiSourceCode);
     },
 
     setContent: function(resource, content, majorChange, userCallback)
@@ -556,21 +556,19 @@
             return;
         }
 
-        resource.requestContent(this._setContentWithInitialContent.bind(this, rawSourceCode, content, userCallback));
+        resource.requestContent(this._setContentWithInitialContent.bind(this, rawSourceCode.uiSourceCode, content, userCallback));
     },
 
-    _setContentWithInitialContent: function(rawSourceCode, content, userCallback, oldContent)
+    _setContentWithInitialContent: function(uiSourceCode, content, userCallback, oldContent)
     {
         function callback(error)
         {
             if (userCallback)
                 userCallback(error);
-            if (!error) {
-                this._presentationModel._updateBreakpointsAfterLiveEdit(rawSourceCode.id, oldContent, content);
-                rawSourceCode.reload();
-            }
+            if (!error)
+                this._presentationModel._updateBreakpointsAfterLiveEdit(uiSourceCode, oldContent, content);
         }
-        this._presentationModel.setScriptSource(rawSourceCode.id, content, callback.bind(this));
+        this._presentationModel.setScriptSource(uiSourceCode, content, callback.bind(this));
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/SourceFile.js (94531 => 94532)


--- trunk/Source/WebCore/inspector/front-end/SourceFile.js	2011-09-05 15:01:59 UTC (rev 94531)
+++ trunk/Source/WebCore/inspector/front-end/SourceFile.js	2011-09-05 15:35:05 UTC (rev 94532)
@@ -51,7 +51,7 @@
     this.messages = [];
 
     if (this._hasPendingResource())
-        this._resource.addEventListener("finished", this.reload.bind(this));
+        this._resource.addEventListener("finished", this._reload.bind(this));
 }
 
 WebInspector.RawSourceCode.Events = {
@@ -76,6 +76,11 @@
         return this;
     },
 
+    contentEdited: function()
+    {
+        this._reload();
+    },
+
     rawLocationToUILocation: function(rawLocation)
     {
         var location = this._mapping ? this._mapping.originalToFormatted(rawLocation) : rawLocation;
@@ -116,17 +121,6 @@
         this._requestContent();
     },
 
-    get content()
-    {
-        return this._content;
-    },
-
-    set content(content)
-    {
-        // FIXME: move live edit implementation to SourceFile and remove this setter.
-        this._content = content;
-    },
-
     createSourceMappingIfNeeded: function(callback)
     {
         if (!this._formatted) {
@@ -162,7 +156,7 @@
         for (var i = 0; i < this._scripts.length; ++i)
             this._concatenatedScripts[this._scripts[i].scriptId] = true;
 
-        this.reload();
+        this._reload();
 
         if (!this._contentRequested) {
             this._contentRequested = true;
@@ -170,7 +164,7 @@
         }
     },
 
-    reload: function()
+    _reload: function()
     {
         if (this._contentLoaded) {
             this._contentLoaded = false;
@@ -232,7 +226,7 @@
         this._requestContentCallbacks = [];
 
         if (this._reloadContent)
-            this.reload();
+            this._reload();
     },
 
     _hasPendingResource: function()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to