Title: [117302] trunk
Revision
117302
Author
[email protected]
Date
2012-05-16 09:38:33 -0700 (Wed, 16 May 2012)

Log Message

Web Inspector: extract CompositeUISourceCodeProvider from DebuggerScriptMapping.
https://bugs.webkit.org/show_bug.cgi?id=86634

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Extract refactoring.

* inspector/front-end/DebuggerScriptMapping.js:
(WebInspector.DebuggerScriptMapping):
(WebInspector.DebuggerScriptMapping.prototype.uiSourceCodeProviders):
(WebInspector.DebuggerScriptMapping.prototype._parsedScriptSource):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._loadUISourceCodes):
(WebInspector.ScriptsPanel.prototype._toggleFormatSource):
(WebInspector.CompositeUISourceCodeProvider):
(WebInspector.CompositeUISourceCodeProvider.prototype._registerUISourceCodeProvider):
(WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeAdded):
(WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeReplaced):
(WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeRemoved):
(WebInspector.CompositeUISourceCodeProvider.prototype.uiSourceCodes):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCodeProvider.prototype.uiSourceCodes):
(WebInspector.UISourceCodeProvider.prototype.addEventListener):
(WebInspector.UISourceCodeProvider.prototype.removeEventListener):

LayoutTests:

* http/tests/inspector/compiler-script-mapping.html:
* http/tests/inspector/debugger-test.js:
(initialize_DebuggerTest):
* inspector/debugger/linkifier.html:
* inspector/debugger/scripts-panel.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117301 => 117302)


--- trunk/LayoutTests/ChangeLog	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/LayoutTests/ChangeLog	2012-05-16 16:38:33 UTC (rev 117302)
@@ -1,3 +1,16 @@
+2012-05-16  Pavel Feldman  <[email protected]>
+
+        Web Inspector: extract CompositeUISourceCodeProvider from DebuggerScriptMapping.
+        https://bugs.webkit.org/show_bug.cgi?id=86634
+
+        Reviewed by Vsevolod Vlasov.
+
+        * http/tests/inspector/compiler-script-mapping.html:
+        * http/tests/inspector/debugger-test.js:
+        (initialize_DebuggerTest):
+        * inspector/debugger/linkifier.html:
+        * inspector/debugger/scripts-panel.html:
+
 2012-05-16  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Support script snippets saving.

Modified: trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html (117301 => 117302)


--- trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html	2012-05-16 16:38:33 UTC (rev 117302)
@@ -193,7 +193,8 @@
             WebInspector.settings.sourceMapsEnabled.set(true);
             WebInspector.debuggerModel._reset();
             var debuggerScriptMapping = new WebInspector.DebuggerScriptMapping();
-            debuggerScriptMapping.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCodeAdded);
+            var uiSourceCodeProvider = new WebInspector.CompositeUISourceCodeProvider(debuggerScriptMapping.uiSourceCodeProviders());
+            uiSourceCodeProvider.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCodeAdded);
 
             var script = InspectorTest.createScriptMock("compiled.js", 0, 0, true, "");
             script.sourceMapURL = "http://localhost:8000/inspector/resources/source-map.json_";

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


--- trunk/LayoutTests/http/tests/inspector/debugger-test.js	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/LayoutTests/http/tests/inspector/debugger-test.js	2012-05-16 16:38:33 UTC (rev 117302)
@@ -155,7 +155,7 @@
 
 InspectorTest.showScriptSourceOnScriptsPanel = function(panel, scriptName, callback)
 {
-    var uiSourceCodes = panel._scriptMapping.uiSourceCodes();
+    var uiSourceCodes = panel._uiSourceCodeProvider.uiSourceCodes();
     for (var i = 0; i < uiSourceCodes.length; ++i) {
         if (uiSourceCodes[i].parsedURL.lastPathComponent === scriptName) {
             panel.showUISourceCode(uiSourceCodes[i]);

Modified: trunk/LayoutTests/inspector/debugger/linkifier.html (117301 => 117302)


--- trunk/LayoutTests/inspector/debugger/linkifier.html	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/LayoutTests/inspector/debugger/linkifier.html	2012-05-16 16:38:33 UTC (rev 117302)
@@ -33,7 +33,7 @@
                 break;
             }
         }
-        var uiSourceCodes = WebInspector.panels.scripts._scriptMapping.uiSourceCodes();
+        var uiSourceCodes = WebInspector.panels.scripts._uiSourceCodeProvider.uiSourceCodes();
         for (var i = 0; i < uiSourceCodes.length; ++i) {
             if (uiSourceCodes[i].url ="" WebInspector.inspectedPageURL) {
                 uiSourceCode = uiSourceCodes[i];

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


--- trunk/LayoutTests/inspector/debugger/scripts-panel.html	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html	2012-05-16 16:38:33 UTC (rev 117302)
@@ -18,32 +18,29 @@
         set: function(breakpoints) { persistentBreakpoints = breakpoints; }
     };
 
-    function createDebuggerScriptMappingMock()
+    function createUISourceCodeProviderMock()
     {
-        var model = new WebInspector.Object();
-        model.breakpointsForUISourceCode = function() { return []; };
-        model.messagesForUISourceCode = function() { return []; };
-        model.canEditScriptSource = function() { return true; };
+        var provider = new WebInspector.Object();
         uiSourceCodes = [];
-        model.uiSourceCodes = function() { return uiSourceCodes.slice(); };
-        model._addUISourceCode = function(uiSourceCode)
+        provider.uiSourceCodes = function() { return uiSourceCodes.slice(); };
+        provider._addUISourceCode = function(uiSourceCode)
         {
             uiSourceCodes.push(uiSourceCode);
             this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, uiSourceCode);
         }
-        model._reset = function(preservedItems)
+        provider._reset = function(preservedItems)
         {
             uiSourceCodes = preservedItems || [];
             WebInspector.debuggerModel.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalObjectCleared);
         }
-        model._replaceUISourceCode = function(oldUISourceCode, uiSourceCode)
+        provider._replaceUISourceCode = function(oldUISourceCode, uiSourceCode)
         {
             uiSourceCodes.remove(oldUISourceCode);
             uiSourceCodes.push(uiSourceCode);
             var data = { oldUISourceCode: oldUISourceCode, uiSourceCode: uiSourceCode };
             this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, data);
         }
-        return model;
+        return provider;
     }
     function createUISouceCode(url)
     {
@@ -60,20 +57,20 @@
     InspectorTest.runTestSuite([
         function testInitialLoad(next)
         {
-            var mapping = createDebuggerScriptMappingMock();
+            var provider = createUISourceCodeProviderMock();
             var uiSourceCode = createUISouceCode("foobar.js");
             var uiSourceCodeFoo = createUISouceCode("foo.js");
             var uiSourceCodeBar = createUISouceCode("bar.js");
             var uiSourceCodeBaz = createUISouceCode("baz.js");
 
-            mapping._addUISourceCode(uiSourceCode);
+            provider._addUISourceCode(uiSourceCode);
 
-            var panel = new WebInspector.ScriptsPanel(mapping);
+            var panel = new WebInspector.ScriptsPanel(provider);
             panel.show();
 
-            mapping._addUISourceCode(uiSourceCodeFoo);
-            mapping._addUISourceCode(uiSourceCodeBar);
-            mapping._addUISourceCode(uiSourceCodeBaz);
+            provider._addUISourceCode(uiSourceCodeFoo);
+            provider._addUISourceCode(uiSourceCodeBar);
+            provider._addUISourceCode(uiSourceCodeBaz);
 
             InspectorTest.dumpScriptsNavigator(panel._navigator);
 
@@ -86,21 +83,21 @@
 
         function testReset(next)
         {
-            var mapping = createDebuggerScriptMappingMock();
-            var panel = new WebInspector.ScriptsPanel(mapping);
+            var provider = createUISourceCodeProviderMock();
+            var panel = new WebInspector.ScriptsPanel(provider);
             panel.show();
 
             var uiSourceCodeFoo = createUISouceCode("foo.js");
             var uiSourceCodeBar = createUISouceCode("bar.js");
             var uiSourceCodeBaz = createUISouceCode("baz.js");
 
-            mapping._addUISourceCode(uiSourceCodeFoo);
-            mapping._addUISourceCode(uiSourceCodeBar);
-            mapping._addUISourceCode(uiSourceCodeBaz);
+            provider._addUISourceCode(uiSourceCodeFoo);
+            provider._addUISourceCode(uiSourceCodeBar);
+            provider._addUISourceCode(uiSourceCodeBaz);
 
             InspectorTest.dumpScriptsNavigator(panel._navigator);
 
-            mapping._reset([uiSourceCodeBar]);
+            provider._reset([uiSourceCodeBar]);
             InspectorTest.dumpScriptsNavigator(panel._navigator);
 
             panel.detach();
@@ -109,20 +106,20 @@
 
         function testSourceReplaced(next)
         {
-            var mapping = createDebuggerScriptMappingMock();
-            var panel = new WebInspector.ScriptsPanel(mapping);
+            var provider = createUISourceCodeProviderMock();
+            var panel = new WebInspector.ScriptsPanel(provider);
             panel.show();
 
             var uiSourceCodeFoo = createUISouceCode("foo.js");
-            mapping._addUISourceCode(uiSourceCodeFoo);
+            provider._addUISourceCode(uiSourceCodeFoo);
             var compiledSourceCode = createUISouceCode("compiled.js");
-            mapping._addUISourceCode(compiledSourceCode);
+            provider._addUISourceCode(compiledSourceCode);
 
             InspectorTest.dumpScriptsNavigator(panel._navigator);
 
             // Plug compiler source mapping.
             var sourceSourceCode = createUISouceCode("source.js");
-            mapping._replaceUISourceCode(compiledSourceCode, sourceSourceCode);
+            provider._replaceUISourceCode(compiledSourceCode, sourceSourceCode);
 
             InspectorTest.dumpScriptsNavigator(panel._navigator);
             next();

Modified: trunk/Source/WebCore/ChangeLog (117301 => 117302)


--- trunk/Source/WebCore/ChangeLog	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/Source/WebCore/ChangeLog	2012-05-16 16:38:33 UTC (rev 117302)
@@ -1,3 +1,30 @@
+2012-05-16  Pavel Feldman  <[email protected]>
+
+        Web Inspector: extract CompositeUISourceCodeProvider from DebuggerScriptMapping.
+        https://bugs.webkit.org/show_bug.cgi?id=86634
+
+        Reviewed by Vsevolod Vlasov.
+
+        Extract refactoring.
+
+        * inspector/front-end/DebuggerScriptMapping.js:
+        (WebInspector.DebuggerScriptMapping):
+        (WebInspector.DebuggerScriptMapping.prototype.uiSourceCodeProviders):
+        (WebInspector.DebuggerScriptMapping.prototype._parsedScriptSource):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._loadUISourceCodes):
+        (WebInspector.ScriptsPanel.prototype._toggleFormatSource):
+        (WebInspector.CompositeUISourceCodeProvider):
+        (WebInspector.CompositeUISourceCodeProvider.prototype._registerUISourceCodeProvider):
+        (WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeAdded):
+        (WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeReplaced):
+        (WebInspector.CompositeUISourceCodeProvider.prototype._handleUISourceCodeRemoved):
+        (WebInspector.CompositeUISourceCodeProvider.prototype.uiSourceCodes):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UISourceCodeProvider.prototype.uiSourceCodes):
+        (WebInspector.UISourceCodeProvider.prototype.addEventListener):
+        (WebInspector.UISourceCodeProvider.prototype.removeEventListener):
+
 2012-05-16  Alexander Pavlov  <[email protected]>
 
         Web Inspector: Double Clicking on "No watch expressions" should add an _expression_

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerScriptMapping.js (117301 => 117302)


--- trunk/Source/WebCore/inspector/front-end/DebuggerScriptMapping.js	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerScriptMapping.js	2012-05-16 16:38:33 UTC (rev 117302)
@@ -30,8 +30,6 @@
 
 /**
  * @constructor
- * @extends {WebInspector.Object}
- * @implements {WebInspector.UISourceCodeProvider}
  */
 WebInspector.DebuggerScriptMapping = function()
 {
@@ -43,11 +41,6 @@
     this._mappings.push(this._compilerMapping);
     this._snippetMapping = WebInspector.scriptSnippetModel.scriptMapping;
     this._mappings.push(this._snippetMapping);
-    for (var i = 0; i < this._mappings.length; ++i) {
-        this._mappings[i].addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this);
-        this._mappings[i].addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._handleUISourceCodeReplaced, this);
-        this._mappings[i].addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._handleUISourceCodeRemoved, this);
-    }
 
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this);
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScriptSource, this);
@@ -56,54 +49,24 @@
 
 WebInspector.DebuggerScriptMapping.prototype = {
     /**
-     * @param {WebInspector.Event} event
+     * @return {Array.<WebInspector.UISourceCodeProvider>}
      */
-    _parsedScriptSource: function(event)
+    uiSourceCodeProviders: function()
     {
-        var script = /** @type {WebInspector.Script} */ event.data;
-        var mapping = this._mappingForScript(script);
-        mapping.addScript(script);
+        return this._mappings;
     },
 
     /**
-     * @return {Array.<WebInspector.UISourceCode>}
-     */
-    uiSourceCodes: function()
-    {
-        var result = [];
-        for (var i = 0; i < this._mappings.length; ++i) {
-            var uiSourceCodeList = this._mappings[i].uiSourceCodes();
-            for (var j = 0; j < uiSourceCodeList.length; ++j)
-                result.push(uiSourceCodeList[j]);
-        }
-        return result;
-    },
-
-    /**
      * @param {WebInspector.Event} event
      */
-    _handleUISourceCodeAdded: function(event)
+    _parsedScriptSource: function(event)
     {
-        this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, event.data);
+        var script = /** @type {WebInspector.Script} */ event.data;
+        var mapping = this._mappingForScript(script);
+        mapping.addScript(script);
     },
 
     /**
-     * @param {WebInspector.Event} event
-     */
-    _handleUISourceCodeReplaced: function(event)
-    {
-        this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, event.data);
-    },
-
-    /**
-     * @param {WebInspector.Event} event
-     */
-    _handleUISourceCodeRemoved: function(event)
-    {
-        this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, event.data);
-    },
-
-    /**
      * @param {WebInspector.Script} script
      * @return {WebInspector.SourceMapping}
      */
@@ -128,5 +91,3 @@
             this._mappings[i].reset();
     }
 }
-
-WebInspector.DebuggerScriptMapping.prototype.__proto__ = WebInspector.Object.prototype;

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


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2012-05-16 16:38:33 UTC (rev 117302)
@@ -28,9 +28,9 @@
  * @constructor
  * @implements {WebInspector.TabbedEditorContainerDelegate}
  * @extends {WebInspector.Panel}
- * @param {WebInspector.DebuggerScriptMapping=} scriptMappingForTest
+ * @param {WebInspector.CompositeUISourceCodeProvider=} uiSourceCodeProviderForTest
  */
-WebInspector.ScriptsPanel = function(scriptMappingForTest)
+WebInspector.ScriptsPanel = function(uiSourceCodeProviderForTest)
 {
     WebInspector.Panel.call(this, "scripts");
     this.registerRequiredCSS("scriptsPanel.css");
@@ -39,10 +39,12 @@
     WebInspector.settings.navigatorWasOnceHidden = WebInspector.settings.createSetting("navigatorWasOnceHidden", false);
     WebInspector.settings.debuggerSidebarHidden = WebInspector.settings.createSetting("debuggerSidebarHidden", false);
 
-    this._scriptMapping = scriptMappingForTest || new WebInspector.DebuggerScriptMapping();
-    new WebInspector.PresentationConsoleMessageHelper(this._scriptMapping);
-    new WebInspector.DebuggerResourceBinding(this._scriptMapping);
+    var scriptMapping = new WebInspector.DebuggerScriptMapping();
+    this._uiSourceCodeProvider = uiSourceCodeProviderForTest || new WebInspector.CompositeUISourceCodeProvider(scriptMapping.uiSourceCodeProviders());
 
+    new WebInspector.PresentationConsoleMessageHelper(this._uiSourceCodeProvider);
+    new WebInspector.DebuggerResourceBinding(this._uiSourceCodeProvider);
+
     function viewGetter()
     {
         return this.visibleView;
@@ -79,7 +81,7 @@
 
     this._editorContainer = new WebInspector.TabbedEditorContainer(this, "previouslyViewedFiles");
     this._editorContainer.show(this.editorView.mainElement);
-    WebInspector.OpenScriptDialog.install(this, this._scriptMapping, this.editorView.mainElement);
+    WebInspector.OpenScriptDialog.install(this, this._uiSourceCodeProvider, this.editorView.mainElement);
 
     this._navigatorController = new WebInspector.NavigatorOverlayController(this, this.editorView, this._navigator.view, this._editorContainer.view);
 
@@ -172,15 +174,15 @@
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._reset.bind(this, false));
     WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, this);
 
-    this._scriptMapping.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this);
-    this._scriptMapping.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
-    this._scriptMapping.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
+    this._uiSourceCodeProvider.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this);
+    this._uiSourceCodeProvider.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
+    this._uiSourceCodeProvider.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
 
     var enableDebugger = !Capabilities.debuggerCausesRecompilation || WebInspector.settings.debuggerEnabled.get();
     if (enableDebugger)
         WebInspector.debuggerModel.enableDebugger();
 
-    WebInspector.advancedSearchController.registerSearchScope(new WebInspector.ScriptsSearchScope(this._scriptMapping));
+    WebInspector.advancedSearchController.registerSearchScope(new WebInspector.ScriptsSearchScope(this._uiSourceCodeProvider));
 }
 
 // Keep these in sync with WebCore::ScriptDebugServer
@@ -234,7 +236,7 @@
 
     _loadUISourceCodes: function()
     {
-        var uiSourceCodes = this._scriptMapping.uiSourceCodes();
+        var uiSourceCodes = this._uiSourceCodeProvider.uiSourceCodes();
         for (var i = 0; i < uiSourceCodes.length; ++i)
             this._uiSourceCodeAdded(uiSourceCodes[i]);
     },
@@ -913,7 +915,7 @@
     _toggleFormatSource: function()
     {
         this._toggleFormatSourceButton.toggled = !this._toggleFormatSourceButton.toggled;
-        var uiSourceCodes = this._scriptMapping.uiSourceCodes();
+        var uiSourceCodes = this._uiSourceCodeProvider.uiSourceCodes();
         for (var i = 0; i < uiSourceCodes.length; ++i)
             uiSourceCodes[i].setFormatted(this._toggleFormatSourceButton.toggled);
     },
@@ -994,7 +996,79 @@
                 this._navigatorController.hideNavigatorOverlay();
             this._showSourceLine(snippetJavaScriptSource);
         }
+    },
+
+    /**
+     * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider
+     */
+    registerUISourceCodeProvider: function(uiSourceCodeProvider)
+    {
+        this._uiSourceCodeProvider._registerUISourceCodeProvider(uiSourceCodeProvider);
     }
 }
 
 WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ * @implements {WebInspector.UISourceCodeProvider}
+ * @param {Array.<WebInspector.UISourceCodeProvider>} uiSourceCodeProviders
+ */
+WebInspector.CompositeUISourceCodeProvider = function(uiSourceCodeProviders)
+{
+    WebInspector.Object.call(this);
+    this._uiSourceCodeProviders = [];
+    for (var i = 0; i < uiSourceCodeProviders.length; ++i)
+        this._registerUISourceCodeProvider(uiSourceCodeProviders[i]);
+}
+
+WebInspector.CompositeUISourceCodeProvider.prototype = {
+    /**
+     * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider
+     */
+    _registerUISourceCodeProvider: function(uiSourceCodeProvider)
+    {
+        this._uiSourceCodeProviders.push(uiSourceCodeProvider);
+        uiSourceCodeProvider.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._handleUISourceCodeAdded, this);
+        uiSourceCodeProvider.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._handleUISourceCodeReplaced, this);
+        uiSourceCodeProvider.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._handleUISourceCodeRemoved, this);
+    },
+
+    _handleUISourceCodeAdded: function(event)
+    {
+        this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, event.data);
+    },
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _handleUISourceCodeReplaced: function(event)
+    {
+        this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, event.data);
+    },
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _handleUISourceCodeRemoved: function(event)
+    {
+        this.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, event.data);
+    },
+
+    /**
+     * @return {Array.<WebInspector.UISourceCode>}
+     */
+    uiSourceCodes: function()
+    {
+        var result = [];
+        for (var i = 0; i < this._uiSourceCodeProviders.length; ++i) {
+            var uiSourceCodes = this._uiSourceCodeProviders[i].uiSourceCodes();
+            for (var j = 0; j < uiSourceCodes.length; ++j)
+                result.push(uiSourceCodes[j]);
+        }
+        return result;
+    }
+}
+
+WebInspector.CompositeUISourceCodeProvider.prototype.__proto__ = WebInspector.Object.prototype;

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


--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-05-16 16:38:33 UTC (rev 117302)
@@ -306,7 +306,21 @@
     /**
      * @return {Array.<WebInspector.UISourceCode>}
      */
-    uiSourceCodes: function() {}
+    uiSourceCodes: function() {},
+
+    /**
+     * @param {string} eventType
+     * @param {function(WebInspector.Event)} listener
+     * @param {Object=} thisObject
+     */
+    addEventListener: function(eventType, listener, thisObject) { },
+
+    /**
+     * @param {string} eventType
+     * @param {function(WebInspector.Event)} listener
+     * @param {Object=} thisObject
+     */
+    removeEventListener: function(eventType, listener, thisObject) { }
 }
 
 /**

Modified: trunk/Source/WebKit/chromium/src/js/Tests.js (117301 => 117302)


--- trunk/Source/WebKit/chromium/src/js/Tests.js	2012-05-16 16:30:10 UTC (rev 117301)
+++ trunk/Source/WebKit/chromium/src/js/Tests.js	2012-05-16 16:38:33 UTC (rev 117302)
@@ -649,7 +649,7 @@
         return !!uiSourceCode.url;
     }
 
-    var uiSourceCodes = WebInspector.panels.scripts._scriptMapping.uiSourceCodes();
+    var uiSourceCodes = WebInspector.panels.scripts._uiSourceCodeProvider.uiSourceCodes();
     return uiSourceCodes.filter(filterOutAnonymous);
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to