Web Inspector: Adopt ES6 Class Syntax for all Model Objects
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Mar 2015 00:18:15 +0000 (00:18 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Mar 2015 00:18:15 +0000 (00:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142858

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

  - Convert WebInspector.Object to a class
  - Convert all UserInterface/Models objects to classes
  - Convert constructor functions to constructor methods
  - Convert "constructor.method" to class static methods where possible
  - Convert all methods to method syntax, eliminate commas between methods
  - Convert all superclass calls in classes to use "super"
  - Workaround <https://webkit.org/b/142862> and add empty constructors
  - Added "deprecated" prefix to addConstructorFunctions, since it is not needed with classes
  - Added many missing calls to super in constructors
  - Added FIXME to WebInspector.Object subclasses not yet moved to classes.
  - Cleaned up SourceMap global properties, moved to constructor instead of prototype
  - Cleaned up Timeline factory constructor to static "create" factory method
  - Fixed any style issues noticed in the mass edit
  - Fixed strict mode issues now that classes enforce strict mode
      - RunLoopTimelineRecord.js was missing a `var` for a local variable
      - "const" is not allowed, converted to "var"
      - "arguments.callee" is not allowed in strict mode

* UserInterface/**/*.js:
Many files modified mostly mechanically.

LayoutTests:

* inspector/model/parse-script-syntax-tree.html:
This test was calling a constructor without "new". Class
syntax enforces "new" and threw an exception.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181769 268f45cc-cd09-0410-ab3c-d52691b4dbfc

182 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/model/parse-script-syntax-tree.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Object.js
Source/WebInspectorUI/UserInterface/Base/Test.js
Source/WebInspectorUI/UserInterface/Controllers/AnalyzerManager.js
Source/WebInspectorUI/UserInterface/Controllers/Annotator.js
Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js
Source/WebInspectorUI/UserInterface/Controllers/BranchManager.js
Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js
Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js
Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js
Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js
Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js
Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Controllers/FormatterSourceMap.js
Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js
Source/WebInspectorUI/UserInterface/Controllers/IssueManager.js
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js
Source/WebInspectorUI/UserInterface/Controllers/LayerTreeManager.js
Source/WebInspectorUI/UserInterface/Controllers/LogManager.js
Source/WebInspectorUI/UserInterface/Controllers/ProbeManager.js
Source/WebInspectorUI/UserInterface/Controllers/ReplayManager.js
Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js
Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js
Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js
Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
Source/WebInspectorUI/UserInterface/Models/AnalyzerMessage.js
Source/WebInspectorUI/UserInterface/Models/ApplicationCacheFrame.js
Source/WebInspectorUI/UserInterface/Models/ApplicationCacheManifest.js
Source/WebInspectorUI/UserInterface/Models/BackForwardEntry.js
Source/WebInspectorUI/UserInterface/Models/Branch.js
Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js
Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
Source/WebInspectorUI/UserInterface/Models/CSSMedia.js
Source/WebInspectorUI/UserInterface/Models/CSSProperty.js
Source/WebInspectorUI/UserInterface/Models/CSSRule.js
Source/WebInspectorUI/UserInterface/Models/CSSSelector.js
Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js
Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js
Source/WebInspectorUI/UserInterface/Models/CallFrame.js
Source/WebInspectorUI/UserInterface/Models/CollectionEntry.js
Source/WebInspectorUI/UserInterface/Models/CollectionEntryPreview.js
Source/WebInspectorUI/UserInterface/Models/Color.js
Source/WebInspectorUI/UserInterface/Models/ContentFlow.js
Source/WebInspectorUI/UserInterface/Models/CookieStorageObject.js
Source/WebInspectorUI/UserInterface/Models/DOMNode.js
Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
Source/WebInspectorUI/UserInterface/Models/DOMSearchMatchObject.js
Source/WebInspectorUI/UserInterface/Models/DOMStorageObject.js
Source/WebInspectorUI/UserInterface/Models/DOMTree.js
Source/WebInspectorUI/UserInterface/Models/DatabaseObject.js
Source/WebInspectorUI/UserInterface/Models/DatabaseTableObject.js
Source/WebInspectorUI/UserInterface/Models/DebuggerDashboard.js
Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js
Source/WebInspectorUI/UserInterface/Models/ExecutionContext.js
Source/WebInspectorUI/UserInterface/Models/ExecutionContextList.js
Source/WebInspectorUI/UserInterface/Models/Frame.js
Source/WebInspectorUI/UserInterface/Models/Geometry.js
Source/WebInspectorUI/UserInterface/Models/Gradient.js
Source/WebInspectorUI/UserInterface/Models/IndexedDatabase.js
Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStore.js
Source/WebInspectorUI/UserInterface/Models/IndexedDatabaseObjectStoreIndex.js
Source/WebInspectorUI/UserInterface/Models/IssueMessage.js
Source/WebInspectorUI/UserInterface/Models/KeyboardShortcut.js
Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js
Source/WebInspectorUI/UserInterface/Models/LazySourceCodeLocation.js
Source/WebInspectorUI/UserInterface/Models/LineWidget.js
Source/WebInspectorUI/UserInterface/Models/LogObject.js
Source/WebInspectorUI/UserInterface/Models/NetworkTimeline.js
Source/WebInspectorUI/UserInterface/Models/ObjectPreview.js
Source/WebInspectorUI/UserInterface/Models/Probe.js
Source/WebInspectorUI/UserInterface/Models/ProbeSet.js
Source/WebInspectorUI/UserInterface/Models/ProbeSetDataFrame.js
Source/WebInspectorUI/UserInterface/Models/ProbeSetDataTable.js
Source/WebInspectorUI/UserInterface/Models/Profile.js
Source/WebInspectorUI/UserInterface/Models/ProfileNode.js
Source/WebInspectorUI/UserInterface/Models/ProfileNodeCall.js
Source/WebInspectorUI/UserInterface/Models/PropertyDescriptor.js
Source/WebInspectorUI/UserInterface/Models/PropertyPath.js
Source/WebInspectorUI/UserInterface/Models/PropertyPreview.js
Source/WebInspectorUI/UserInterface/Models/ReplayDashboard.js
Source/WebInspectorUI/UserInterface/Models/ReplaySession.js
Source/WebInspectorUI/UserInterface/Models/ReplaySessionSegment.js
Source/WebInspectorUI/UserInterface/Models/Resource.js
Source/WebInspectorUI/UserInterface/Models/ResourceCollection.js
Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js
Source/WebInspectorUI/UserInterface/Models/Revision.js
Source/WebInspectorUI/UserInterface/Models/RunLoopTimelineRecord.js
Source/WebInspectorUI/UserInterface/Models/ScopeChainNode.js
Source/WebInspectorUI/UserInterface/Models/Script.js
Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js
Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
Source/WebInspectorUI/UserInterface/Models/Setting.js
Source/WebInspectorUI/UserInterface/Models/SourceCode.js
Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js
Source/WebInspectorUI/UserInterface/Models/SourceCodePosition.js
Source/WebInspectorUI/UserInterface/Models/SourceCodeRevision.js
Source/WebInspectorUI/UserInterface/Models/SourceCodeSearchMatchObject.js
Source/WebInspectorUI/UserInterface/Models/SourceCodeTextRange.js
Source/WebInspectorUI/UserInterface/Models/SourceCodeTimeline.js
Source/WebInspectorUI/UserInterface/Models/SourceMap.js
Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js
Source/WebInspectorUI/UserInterface/Models/TextMarker.js
Source/WebInspectorUI/UserInterface/Models/TextRange.js
Source/WebInspectorUI/UserInterface/Models/Timeline.js
Source/WebInspectorUI/UserInterface/Models/TimelineMarker.js
Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js
Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js
Source/WebInspectorUI/UserInterface/Models/TypeSet.js
Source/WebInspectorUI/UserInterface/Models/UnitBezier.js
Source/WebInspectorUI/UserInterface/Protocol/ApplicationCacheObserver.js
Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js
Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js
Source/WebInspectorUI/UserInterface/Protocol/DOMObserver.js
Source/WebInspectorUI/UserInterface/Protocol/DOMStorageObserver.js
Source/WebInspectorUI/UserInterface/Protocol/DatabaseObserver.js
Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js
Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js
Source/WebInspectorUI/UserInterface/Protocol/LayerTreeObserver.js
Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js
Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js
Source/WebInspectorUI/UserInterface/Protocol/ReplayObserver.js
Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js
Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js
Source/WebInspectorUI/UserInterface/Test.html
Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
Source/WebInspectorUI/UserInterface/Views/ColorPicker.js
Source/WebInspectorUI/UserInterface/Views/ColorWheel.js
Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js
Source/WebInspectorUI/UserInterface/Views/ConsoleCommand.js
Source/WebInspectorUI/UserInterface/Views/ConsoleGroup.js
Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js
Source/WebInspectorUI/UserInterface/Views/ConsoleSession.js
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/ContentView.js
Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.js
Source/WebInspectorUI/UserInterface/Views/DashboardView.js
Source/WebInspectorUI/UserInterface/Views/DetailsSection.js
Source/WebInspectorUI/UserInterface/Views/DetailsSectionGroup.js
Source/WebInspectorUI/UserInterface/Views/DetailsSectionRow.js
Source/WebInspectorUI/UserInterface/Views/FilterBar.js
Source/WebInspectorUI/UserInterface/Views/FindBanner.js
Source/WebInspectorUI/UserInterface/Views/GoToLineDialog.js
Source/WebInspectorUI/UserInterface/Views/HierarchicalPathComponent.js
Source/WebInspectorUI/UserInterface/Views/HoverMenu.js
Source/WebInspectorUI/UserInterface/Views/IndeterminateProgressSpinner.js
Source/WebInspectorUI/UserInterface/Views/LayoutTimelineDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/NavigationBar.js
Source/WebInspectorUI/UserInterface/Views/NavigationItem.js
Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js
Source/WebInspectorUI/UserInterface/Views/Popover.js
Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/QuickConsole.js
Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js
Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/Section.js
Source/WebInspectorUI/UserInterface/Views/Sidebar.js
Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/TextEditor.js
Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js
Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js
Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js
Source/WebInspectorUI/UserInterface/Views/TimelineRecordFrame.js
Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js
Source/WebInspectorUI/UserInterface/Views/Toolbar.js
Source/WebInspectorUI/UserInterface/Views/TreeElementStatusButton.js
Source/WebInspectorUI/UserInterface/Views/TreeOutline.js
Source/WebInspectorUI/UserInterface/Views/TreeOutlineDataGridSynchronizer.js
Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js

index 10c0bc7..553d0f4 100644 (file)
@@ -1,3 +1,14 @@
+2015-03-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Adopt ES6 Class Syntax for all Model Objects
+        https://bugs.webkit.org/show_bug.cgi?id=142858
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/model/parse-script-syntax-tree.html:
+        This test was calling a constructor without "new". Class
+        syntax enforces "new" and threw an exception.
+
 2015-03-19  Enrica Casucci  <enrica@apple.com>
 
         <attachment> should put URLs on the pasteboard so that Finder can accept drops.
index 1101282..392e633 100644 (file)
@@ -7,7 +7,7 @@ function test()
 {
     function makeNode(text, isExpression)
     {
-        var script = new WebInspector.Script(1, WebInspector.TextRange(0, text.length));
+        var script = new WebInspector.Script(1, new WebInspector.TextRange(0, text.length));
         var scriptSyntaxTree = new WebInspector.ScriptSyntaxTree(text, script);
         var syntaxTree = scriptSyntaxTree._syntaxTree;
 
index 5b385cb..83d3a72 100644 (file)
@@ -1,3 +1,31 @@
+2015-03-19  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Adopt ES6 Class Syntax for all Model Objects
+        https://bugs.webkit.org/show_bug.cgi?id=142858
+
+        Reviewed by Timothy Hatcher.
+
+          - Convert WebInspector.Object to a class
+          - Convert all UserInterface/Models objects to classes
+          - Convert constructor functions to constructor methods
+          - Convert "constructor.method" to class static methods where possible
+          - Convert all methods to method syntax, eliminate commas between methods
+          - Convert all superclass calls in classes to use "super"
+          - Workaround <https://webkit.org/b/142862> and add empty constructors
+          - Added "deprecated" prefix to addConstructorFunctions, since it is not needed with classes
+          - Added many missing calls to super in constructors
+          - Added FIXME to WebInspector.Object subclasses not yet moved to classes.
+          - Cleaned up SourceMap global properties, moved to constructor instead of prototype
+          - Cleaned up Timeline factory constructor to static "create" factory method
+          - Fixed any style issues noticed in the mass edit
+          - Fixed strict mode issues now that classes enforce strict mode
+              - RunLoopTimelineRecord.js was missing a `var` for a local variable
+              - "const" is not allowed, converted to "var"
+              - "arguments.callee" is not allowed in strict mode
+
+        * UserInterface/**/*.js:
+        Many files modified mostly mechanically.
+
 2015-03-19  Jono Wells  <jonowells@apple.com>
 
         Web Inspector: Debugger sidebar header should say "Scripts" instead of "Breakpoints", appear only on pause
index 514aef3..bea3d34 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Object = function()
+WebInspector.Object = class Object
 {
-};
-
-WebInspector.Object.addConstructorFunctions = function(subclassConstructor)
-{
-    // Copies the relevant functions the subclass constructor.
-    for (var property in WebInspector.Object) {
-        var value = WebInspector.Object[property];
-        if (typeof value !== "function")
-            continue;
-        if (value === arguments.callee)
-            continue;
-        subclassConstructor[property] = value;
+    constructor()
+    {
+        // FIXME: Remove once <https://webkit.org/b/142862> is fixed.
     }
-};
-
-WebInspector.Object.addEventListener = function(eventType, listener, thisObject)
-{
-    thisObject = thisObject || null;
 
-    console.assert(eventType, "Object.addEventListener: invalid event type ", eventType, "(listener: ", listener, "thisObject: ", thisObject, ")");
-    if (!eventType)
-        return;
+    // Static
 
-    console.assert(listener, "Object.addEventListener: invalid listener ", listener, "(event type: ", eventType, "thisObject: ", thisObject, ")");
-    if (!listener)
-        return;
-
-    if (!this._listeners)
-        this._listeners = {};
+    static addEventListener(eventType, listener, thisObject)
+    {
+        thisObject = thisObject || null;
 
-    var listeners = this._listeners[eventType];
-    if (!listeners)
-        listeners = this._listeners[eventType] = [];
+        console.assert(eventType, "Object.addEventListener: invalid event type ", eventType, "(listener: ", listener, "thisObject: ", thisObject, ")");
+        if (!eventType)
+            return;
 
-    // Prevent registering multiple times.
-    for (var i = 0; i < listeners.length; ++i) {
-        if (listeners[i].listener === listener && listeners[i].thisObject === thisObject)
+        console.assert(listener, "Object.addEventListener: invalid listener ", listener, "(event type: ", eventType, "thisObject: ", thisObject, ")");
+        if (!listener)
             return;
-    }
 
-    listeners.push({thisObject, listener});
-};
+        if (!this._listeners)
+            this._listeners = {};
 
-WebInspector.Object.removeEventListener = function(eventType, listener, thisObject)
-{
-    eventType = eventType || null;
-    listener = listener || null;
-    thisObject = thisObject || null;
+        var listeners = this._listeners[eventType];
+        if (!listeners)
+            listeners = this._listeners[eventType] = [];
 
-    if (!this._listeners)
-        return;
+        // Prevent registering multiple times.
+        for (var i = 0; i < listeners.length; ++i) {
+            if (listeners[i].listener === listener && listeners[i].thisObject === thisObject)
+                return;
+        }
 
-    if (!eventType) {
-        for (eventType in this._listeners)
-            this.removeEventListener(eventType, listener, thisObject);
-        return;
+        listeners.push({thisObject, listener});
     }
 
-    var listeners = this._listeners[eventType];
-    if (!listeners)
-        return;
+    static removeEventListener(eventType, listener, thisObject)
+    {
+        eventType = eventType || null;
+        listener = listener || null;
+        thisObject = thisObject || null;
 
-    for (var i = listeners.length - 1; i >= 0; --i) {
-        if (listener && listeners[i].listener === listener && listeners[i].thisObject === thisObject)
-            listeners.splice(i, 1);
-        else if (!listener && thisObject && listeners[i].thisObject === thisObject)
-            listeners.splice(i, 1);
-    }
+        if (!this._listeners)
+            return;
 
-    if (!listeners.length)
-        delete this._listeners[eventType];
+        if (!eventType) {
+            for (eventType in this._listeners)
+                this.removeEventListener(eventType, listener, thisObject);
+            return;
+        }
 
-    if (!Object.keys(this._listeners).length)
-        delete this._listeners;
-};
+        var listeners = this._listeners[eventType];
+        if (!listeners)
+            return;
 
-WebInspector.Object.removeAllListeners = function()
-{
-    delete this._listeners;
-};
+        for (var i = listeners.length - 1; i >= 0; --i) {
+            if (listener && listeners[i].listener === listener && listeners[i].thisObject === thisObject)
+                listeners.splice(i, 1);
+            else if (!listener && thisObject && listeners[i].thisObject === thisObject)
+                listeners.splice(i, 1);
+        }
 
-WebInspector.Object.hasEventListeners = function(eventType)
-{
-    if (!this._listeners || !this._listeners[eventType])
-        return false;
-    return true;
-};
+        if (!listeners.length)
+            delete this._listeners[eventType];
 
-WebInspector.Object.prototype = {
-    constructor: WebInspector.Object,
+        if (!Object.keys(this._listeners).length)
+            delete this._listeners;
+    }
 
-    addEventListener: WebInspector.Object.addEventListener,
+    static removeAllListeners()
+    {
+        delete this._listeners;
+    }
 
-    removeEventListener: WebInspector.Object.removeEventListener,
+    static hasEventListeners(eventType)
+    {
+        if (!this._listeners || !this._listeners[eventType])
+            return false;
+        return true;
+    }
 
-    removeAllListeners: WebInspector.Object.removeAllListeners,
+    // Public
 
-    hasEventListeners: WebInspector.Object.hasEventListeners,
+    addEventListener() { return WebInspector.Object.addEventListener.apply(this, arguments); }
+    removeEventListener() { return WebInspector.Object.removeEventListener.apply(this, arguments); }
+    removeAllListeners() { return WebInspector.Object.removeAllListeners.apply(this, arguments); }
+    hasEventListeners() { return WebInspector.Object.hasEventListeners.apply(this, arguments); }
 
-    dispatchEventToListeners: function(eventType, eventData)
+    dispatchEventToListeners(eventType, eventData)
     {
         var event = new WebInspector.Event(this, eventType, eventData);
 
@@ -165,24 +153,38 @@ WebInspector.Object.prototype = {
     }
 };
 
-WebInspector.Event = function(target, type, data)
+// FIXME: Uses arguments.callee, so it cannot be in the class.
+WebInspector.Object.deprecatedAddConstructorFunctions = function(subclassConstructor)
 {
-    this.target = target;
-    this.type = type;
-    this.data = data;
-    this.defaultPrevented = false;
-    this._stoppedPropagation = false;
+    // Copies the relevant functions to the subclass constructor.
+    var list = ["addEventListener", "removeEventListener", "removeAllListeners", "hasEventListeners"];
+    for (var property of list) {
+        var value = WebInspector.Object[property];
+        if (typeof value !== "function")
+            continue;
+        if (value === arguments.callee)
+            continue;
+        subclassConstructor[property] = value;
+    }
 };
 
-WebInspector.Event.prototype = {
-    constructor: WebInspector.Event,
+WebInspector.Event = class Event
+{
+    constructor(target, type, data)
+    {
+        this.target = target;
+        this.type = type;
+        this.data = data;
+        this.defaultPrevented = false;
+        this._stoppedPropagation = false;
+    }
 
-    stopPropagation: function()
+    stopPropagation()
     {
         this._stoppedPropagation = true;
-    },
+    }
 
-    preventDefault: function()
+    preventDefault()
     {
         this.defaultPrevented = true;
     }
index ea1ceb7..273207e 100644 (file)
@@ -103,7 +103,8 @@ InspectorTest.dumpMessagesToConsole = false;
 // prototype, and prototype chain for the singleton InspectorTest.
 InspectorTest.EventDispatcher = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 };
 
 InspectorTest.EventDispatcher.Event = {
index 08cf162..3dc11f1 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.AnalyzerManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     this._eslintConfig = {
         env: {
index d363491..160275d 100644 (file)
@@ -26,7 +26,8 @@
 
 WebInspector.Annotator = function(sourceCodeTextEditor)
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     console.assert(sourceCodeTextEditor instanceof WebInspector.SourceCodeTextEditor, sourceCodeTextEditor);
 
index e8a07be..8da649c 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.ApplicationCacheManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     if (window.ApplicationCacheAgent)
         ApplicationCacheAgent.enable();
index 67ecdb2..b3235e0 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.BranchManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
index 7eeae35..fa6e2d4 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.CSSStyleManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     if (window.CSSAgent)
         CSSAgent.enable();
index 2dd8aab..4da8c43 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.CodeMirrorCompletionController = function(codeMirror, delegate, stopCharactersRegex)
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     console.assert(codeMirror);
 
index 01b95be..90639d5 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.CodeMirrorEditingController = function(codeMirror, marker)
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     this._codeMirror = codeMirror;
     this._marker = marker;
index d7a8fd9..34ece17 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.CodeMirrorTokenTrackingController = function(codeMirror, delegate)
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     console.assert(codeMirror);
 
index 84e4cdf..7116ffb 100644 (file)
@@ -41,7 +41,8 @@ WebInspector.DOMTreeManager = function() {
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 };
 
-WebInspector.Object.addConstructorFunctions(WebInspector.DOMTreeManager);
+// FIXME: Move to a WebInspector.Object subclass and we can remove this.
+WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.DOMTreeManager);
 
 WebInspector.DOMTreeManager.Event = {
     AttributeModified: "dom-tree-manager-attribute-modified",
index 9425a5e..c848b27 100644 (file)
@@ -24,7 +24,8 @@
  */
 
 WebInspector.DashboardManager = function() {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     this._dashboards = {};
     this._dashboards.default = new WebInspector.DefaultDashboard;
index 021f8c5..effd8b5 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.DebuggerManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     if (window.DebuggerAgent)
         DebuggerAgent.enable();
index 0ae1c3a..a80f6ca 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.FormatterSourceMap = function(originalLineEndings, formattedLineEndings, mapping)
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     this._originalLineEndings = originalLineEndings;
     this._formattedLineEndings = formattedLineEndings;
index d8214e9..911b54b 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.FrameResourceManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     if (window.PageAgent)
         PageAgent.enable();
@@ -37,7 +38,8 @@ WebInspector.FrameResourceManager = function()
     this.initialize();
 };
 
-WebInspector.Object.addConstructorFunctions(WebInspector.FrameResourceManager);
+// FIXME: Move to a WebInspector.Object subclass and we can remove this.
+WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.FrameResourceManager);
 
 WebInspector.FrameResourceManager.Event = {
     FrameWasAdded: "frame-resource-manager-frame-was-added",
index 6322042..f20e959 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.IssueManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.ActiveLogCleared, this._activeLogCleared, this);
index 5c2b107..926827f 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.JavaScriptLogViewController = function(element, scrollElement, textPrompt, delegate, historySettingIdentifier)
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     console.assert(textPrompt instanceof WebInspector.ConsolePrompt);
     console.assert(historySettingIdentifier);
index 16816d6..7d5112d 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.JavaScriptRuntimeCompletionProvider = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     console.assert(!WebInspector.JavaScriptRuntimeCompletionProvider._instance);
 
index dde40fa..1b38749 100644 (file)
@@ -24,7 +24,8 @@
  */
 
 WebInspector.LayerTreeManager = function() {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     this._supported = !!window.LayerTreeAgent;
 
index d8f8dbd..4acd5ba 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.LogManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 };
index 9d9459c..005dbd8 100644 (file)
@@ -26,7 +26,8 @@
 
 WebInspector.ProbeManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     // Used to detect deleted probe actions.
     this._knownProbeIdentifiersForBreakpoint = new Map;
index 5cf9dc2..4804ae2 100644 (file)
@@ -26,7 +26,8 @@
 
 WebInspector.ReplayManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     this._sessionState = WebInspector.ReplayManager.SessionState.Inactive;
     this._segmentState = WebInspector.ReplayManager.SegmentState.Unloaded;
index 77d9046..c9b20c7 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.RuntimeManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     // Enable the RuntimeAgent to receive notification of execution contexts.
     if (RuntimeAgent.enable)
index f3d16cd..caee777 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.SourceMapManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     this._sourceMapURLMap = {};
     this._downloadingSourceMaps = {};
index ceece30..a58acc0 100644 (file)
@@ -26,7 +26,8 @@
 
 WebInspector.StorageManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     if (window.DOMStorageAgent)
         DOMStorageAgent.enable();
index 3f46fd9..113db82 100644 (file)
@@ -25,7 +25,8 @@
 
 WebInspector.TimelineManager = function()
 {
-    WebInspector.Object.call(this);
+    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
+    // WebInspector.Object.call(this);
 
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted, this._startAutoCapturing, this);
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
@@ -431,10 +432,10 @@ WebInspector.TimelineManager.prototype = {
 
         var identifier = this._nextRecordingIdentifier++;
         var newRecording = new WebInspector.TimelineRecording(identifier, WebInspector.UIString("Timeline Recording %d").format(identifier));
-        newRecording.addTimeline(new WebInspector.Timeline(WebInspector.TimelineRecord.Type.Network, newRecording));
-        newRecording.addTimeline(new WebInspector.Timeline(WebInspector.TimelineRecord.Type.RunLoop, newRecording));
-        newRecording.addTimeline(new WebInspector.Timeline(WebInspector.TimelineRecord.Type.Layout, newRecording));
-        newRecording.addTimeline(new WebInspector.Timeline(WebInspector.TimelineRecord.Type.Script, newRecording));
+        newRecording.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Network, newRecording));
+        newRecording.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.RunLoop, newRecording));
+        newRecording.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Layout, newRecording));
+        newRecording.addTimeline(WebInspector.Timeline.create(WebInspector.TimelineRecord.Type.Script, newRecording));
 
         this._recordings.push(newRecording);
         this.dispatchEventToListeners(WebInspector.TimelineManager.Event.RecordingCreated, {recording: newRecording});
index e305567..5d0b951 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.AnalyzerMessage = function(sourceCodeLocation, text, ruleIdentifier)
+WebInspector.AnalyzerMessage = class AnalyzerMessage extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
+    constructor(sourceCodeLocation, text, ruleIdentifier)
+    {
+        super();
 
-    console.assert(sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
-    console.assert(typeof text === "string");
+        console.assert(sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
+        console.assert(typeof text === "string");
 
-    this._sourceCodeLocation = sourceCodeLocation;
-    this._text = text;
-    this._ruleIdentifier = ruleIdentifier;
-};
+        this._sourceCodeLocation = sourceCodeLocation;
+        this._text = text;
+        this._ruleIdentifier = ruleIdentifier;
+    }
 
-WebInspector.AnalyzerMessage.prototype = {
-    constructor: WebInspector.AnalyzerMessage,
-    __proto__: WebInspector.Object.prototype,
+    // Public
 
     get sourceCodeLocation()
     {
         return this._sourceCodeLocation;
-    },
+    }
 
     get sourceCode()
     {
         return this._sourceCodeLocation.sourceCode;
-    },
+    }
 
     get text()
     {
         return this._text;
-    },
+    }
 
     get ruleIdentifier()
     {
index 602299c..befc18a 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheFrame = function(frame, manifest, status)
+WebInspector.ApplicationCacheFrame = class ApplicationCacheFrame extends WebInspector.Object
 {
-    console.assert(frame instanceof WebInspector.Frame);
-    console.assert(manifest instanceof WebInspector.ApplicationCacheManifest);
-
-    WebInspector.Object.call(this);
-
-    this._frame = frame;
-    this._manifest = manifest;
-    this._status = status;
-};
+    constructor(frame, manifest, status)
+    {
+        super();
 
-WebInspector.ApplicationCacheFrame.TypeIdentifier = "application-cache-frame";
-WebInspector.ApplicationCacheFrame.FrameURLCookieKey = "application-cache-frame-url";
-WebInspector.ApplicationCacheFrame.ManifestURLCookieKey = "application-cache-frame-manifest-url";
+        console.assert(frame instanceof WebInspector.Frame);
+        console.assert(manifest instanceof WebInspector.ApplicationCacheManifest);
 
-WebInspector.ApplicationCacheFrame.prototype = {
-    constructor: WebInspector.ApplicationCacheFrame,
+        this._frame = frame;
+        this._manifest = manifest;
+        this._status = status;
+    }
 
     // Public
 
     get frame()
     {
         return this._frame;
-    },
+    }
 
     get manifest()
     {
         return this._manifest;
-    },
+    }
 
     get status()
     {
         return this._status;
-    },
+    }
 
     set status(status)
     {
         this._status = status;
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.ApplicationCacheFrame.FrameURLCookieKey] = this.frame.url;
         cookie[WebInspector.ApplicationCacheFrame.ManifestURLCookieKey] = this.manifest.manifestURL;
     }
 };
 
-WebInspector.ApplicationCacheFrame.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.ApplicationCacheFrame.TypeIdentifier = "application-cache-frame";
+WebInspector.ApplicationCacheFrame.FrameURLCookieKey = "application-cache-frame-url";
+WebInspector.ApplicationCacheFrame.ManifestURLCookieKey = "application-cache-frame-manifest-url";
index e9fd899..e160bb5 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheManifest = function(manifestURL)
+WebInspector.ApplicationCacheManifest = class ApplicationCacheManifest extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._manifestURL = manifestURL;
-};
+    constructor(manifestURL)
+    {
+        super();
 
-WebInspector.ApplicationCacheManifest.prototype = {
-    constructor: WebInspector.ApplicationCacheManifest,
+        this._manifestURL = manifestURL;
+    }
 
     get manifestURL()
     {
         return this._manifestURL;
     }
 };
-
-WebInspector.ApplicationCacheManifest.prototype.__proto__ = WebInspector.Object.prototype;
index 33a7acb..51f0317 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BackForwardEntry = function(contentView, cookie)
+WebInspector.BackForwardEntry = class BackForwardEntry extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-    this._contentView = contentView;
-    // Cookies are compared with Object.shallowEqual, so should not store objects or arrays.
-    this._cookie = cookie || {};
-    this._scrollPositions = [];
+    constructor(contentView, cookie)
+    {
+        super();
 
-    contentView.saveToCookie(this._cookie);
-};
+        this._contentView = contentView;
 
-WebInspector.BackForwardEntry.prototype = {
-    constructor: WebInspector.BackForwardEntry,
-    __proto__: WebInspector.Object.prototype,
+        // Cookies are compared with Object.shallowEqual, so should not store objects or arrays.
+        this._cookie = cookie || {};
+        this._scrollPositions = [];
+
+        contentView.saveToCookie(this._cookie);
+    }
 
     // Public
 
     get contentView()
     {
         return this._contentView;
-    },
+    }
 
     get cookie()
     {
         // Cookies are immutable; they represent a specific navigation action.
         return Object.shallowCopy(this._cookie);
-    },
+    }
 
-    prepareToShow: function(shouldCallShown)
+    prepareToShow(shouldCallShown)
     {
         this._restoreFromCookie();
 
@@ -60,25 +60,25 @@ WebInspector.BackForwardEntry.prototype = {
         if (shouldCallShown)
             this.contentView.shown();
         this.contentView.updateLayout();
-    },
+    }
 
-    prepareToHide: function()
+    prepareToHide()
     {
         this.contentView.visible = false;
         this.contentView.hidden();
 
         this._saveScrollPositions();
-    },
+    }
 
     // Private
 
-    _restoreFromCookie: function()
+    _restoreFromCookie()
     {
         this._restoreScrollPositions();
         this.contentView.restoreFromCookie(this.cookie);
-    },
+    }
 
-    _restoreScrollPositions: function()
+    _restoreScrollPositions()
     {
         // If no scroll positions are saved, do nothing.
         if (!this._scrollPositions.length)
@@ -100,9 +100,9 @@ WebInspector.BackForwardEntry.prototype = {
             // the user won't be left in a weird horizontal position.
             element.scrollLeft = position.isScrolledToBottom ? 0 : position.scrollLeft;
         }
-    },
+    }
 
-    _saveScrollPositions: function()
+    _saveScrollPositions()
     {
         var scrollableElements = this.contentView.scrollableElements || [];
         var scrollPositions = [];
index 87e97c0..73d9515 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Branch = function(displayName, revisions, locked)
+WebInspector.Branch = class Branch extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    console.assert(displayName);
+    constructor(displayName, revisions, locked)
+    {
+        super();
 
-    this._displayName = displayName;
-    this._revisions = revisions instanceof Array ? revisions.slice() : [];
-    this._locked = locked || false;
-};
+        console.assert(displayName);
 
-WebInspector.Branch.prototype = {
-    constructor: WebInspector.Branch,
+        this._displayName = displayName;
+        this._revisions = revisions instanceof Array ? revisions.slice() : [];
+        this._locked = locked || false;
+    }
 
     // Public
 
     get displayName()
     {
         return this._displayName;
-    },
+    }
 
     set displayName(displayName)
     {
@@ -51,19 +50,19 @@ WebInspector.Branch.prototype = {
             return;
 
         this._displayName = displayName;
-    },
+    }
 
     get revisions()
     {
         return this._revisions;
-    },
+    }
 
     get locked()
     {
         return this._locked;
-    },
+    }
 
-    revisionForRepresentedObject: function(representedObject, doNotCreateIfNeeded)
+    revisionForRepresentedObject(representedObject, doNotCreateIfNeeded)
     {
         for (var i = 0; i < this._revisions.length; ++i) {
             var revision = this._revisions[i];
@@ -82,9 +81,9 @@ WebInspector.Branch.prototype = {
         }
 
         return null;
-    },
+    }
 
-    addRevision: function(revision)
+    addRevision(revision)
     {
         console.assert(revision instanceof WebInspector.Revision);
 
@@ -95,9 +94,9 @@ WebInspector.Branch.prototype = {
             return;
 
         this._revisions.push(revision);
-    },
+    }
 
-    removeRevision: function(revision)
+    removeRevision(revision)
     {
         console.assert(revision instanceof WebInspector.Revision);
 
@@ -105,45 +104,43 @@ WebInspector.Branch.prototype = {
             return;
 
         this._revisions.remove(revision);
-    },
+    }
 
-    reset: function()
+    reset()
     {
         if (this._locked)
             return;
 
         this._revisions = [];
-    },
+    }
 
-    fork: function(displayName)
+    fork(displayName)
     {
         var copiedRevisions = this._revisions.map(function(revision) { return revision.copy(); });
         return new WebInspector.Branch(displayName, copiedRevisions);
-    },
+    }
 
-    apply: function()
+    apply()
     {
         for (var i = 0; i < this._revisions.length; ++i)
             this._revisions[i].apply();
-    },
+    }
 
-    revert: function()
+    revert()
     {
         for (var i = this._revisions.length - 1; i >= 0; --i)
             this._revisions[i].revert();
-    },
+    }
 
-    lock: function()
+    lock()
     {
         console.assert(!this._locked);
         this._locked = true;
-    },
+    }
 
-    unlock: function()
+    unlock()
     {
         console.assert(this._locked);
         this._locked = false;
     }
 };
-
-WebInspector.Branch.prototype.__proto__ = WebInspector.Object.prototype;
index c48217e..2821a70 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Breakpoint = function(sourceCodeLocationOrInfo, disabled, condition)
+WebInspector.Breakpoint = class Breakpoint extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    if (sourceCodeLocationOrInfo instanceof WebInspector.SourceCodeLocation) {
-        var sourceCode = sourceCodeLocationOrInfo.sourceCode;
-        var url = sourceCode ? sourceCode.url : null;
-        var scriptIdentifier = sourceCode instanceof WebInspector.Script ? sourceCode.id : null;
-        var location = sourceCodeLocationOrInfo;
-    } else if (sourceCodeLocationOrInfo && typeof sourceCodeLocationOrInfo === "object") {
-        var url = sourceCodeLocationOrInfo.url;
-        var lineNumber = sourceCodeLocationOrInfo.lineNumber || 0;
-        var columnNumber = sourceCodeLocationOrInfo.columnNumber || 0;
-        var location = new WebInspector.SourceCodeLocation(null, lineNumber, columnNumber);
-        var autoContinue = sourceCodeLocationOrInfo.autoContinue || false;
-        var actions = sourceCodeLocationOrInfo.actions || [];
-        for (var i = 0; i < actions.length; ++i)
-            actions[i] = new WebInspector.BreakpointAction(this, actions[i]);
-        disabled = sourceCodeLocationOrInfo.disabled;
-        condition = sourceCodeLocationOrInfo.condition;
-    } else
-        console.error("Unexpected type passed to WebInspector.Breakpoint", sourceCodeLocationOrInfo);
-
-    this._id = null;
-    this._url = url || null;
-    this._scriptIdentifier = scriptIdentifier || null;
-    this._disabled = disabled || false;
-    this._condition = condition || "";
-    this._autoContinue = autoContinue || false;
-    this._actions = actions || [];
-    this._resolved = false;
-
-    this._sourceCodeLocation = location;
-    this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._sourceCodeLocationLocationChanged, this);
-    this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged, this._sourceCodeLocationDisplayLocationChanged, this);
-};
-
-WebInspector.Object.addConstructorFunctions(WebInspector.Breakpoint);
-
-WebInspector.Breakpoint.PopoverClassName = "edit-breakpoint-popover-content";
-WebInspector.Breakpoint.WidePopoverClassName = "wide";
-WebInspector.Breakpoint.PopoverConditionInputId = "edit-breakpoint-popover-condition";
-WebInspector.Breakpoint.PopoverOptionsAutoContinueInputId = "edit-breakpoint-popoover-auto-continue";
-WebInspector.Breakpoint.HiddenStyleClassName = "hidden";
-
-WebInspector.Breakpoint.DefaultBreakpointActionType = WebInspector.BreakpointAction.Type.Log;
-
-WebInspector.Breakpoint.TypeIdentifier = "breakpoint";
-WebInspector.Breakpoint.URLCookieKey = "breakpoint-url";
-WebInspector.Breakpoint.LineNumberCookieKey = "breakpoint-line-number";
-WebInspector.Breakpoint.ColumnNumberCookieKey = "breakpoint-column-number";
-
-WebInspector.Breakpoint.Event = {
-    DisabledStateDidChange: "breakpoint-disabled-state-did-change",
-    ResolvedStateDidChange: "breakpoint-resolved-state-did-change",
-    ConditionDidChange: "breakpoint-condition-did-change",
-    ActionsDidChange: "breakpoint-actions-did-change",
-    AutoContinueDidChange: "breakpoint-auto-continue-did-change",
-    LocationDidChange: "breakpoint-location-did-change",
-    DisplayLocationDidChange: "breakpoint-display-location-did-change",
-};
-
-WebInspector.Breakpoint.prototype = {
-    constructor: WebInspector.Breakpoint,
+    constructor(sourceCodeLocationOrInfo, disabled, condition)
+    {
+        super();
+
+        if (sourceCodeLocationOrInfo instanceof WebInspector.SourceCodeLocation) {
+            var sourceCode = sourceCodeLocationOrInfo.sourceCode;
+            var url = sourceCode ? sourceCode.url : null;
+            var scriptIdentifier = sourceCode instanceof WebInspector.Script ? sourceCode.id : null;
+            var location = sourceCodeLocationOrInfo;
+        } else if (sourceCodeLocationOrInfo && typeof sourceCodeLocationOrInfo === "object") {
+            var url = sourceCodeLocationOrInfo.url;
+            var lineNumber = sourceCodeLocationOrInfo.lineNumber || 0;
+            var columnNumber = sourceCodeLocationOrInfo.columnNumber || 0;
+            var location = new WebInspector.SourceCodeLocation(null, lineNumber, columnNumber);
+            var autoContinue = sourceCodeLocationOrInfo.autoContinue || false;
+            var actions = sourceCodeLocationOrInfo.actions || [];
+            for (var i = 0; i < actions.length; ++i)
+                actions[i] = new WebInspector.BreakpointAction(this, actions[i]);
+            disabled = sourceCodeLocationOrInfo.disabled;
+            condition = sourceCodeLocationOrInfo.condition;
+        } else
+            console.error("Unexpected type passed to WebInspector.Breakpoint", sourceCodeLocationOrInfo);
+
+        this._id = null;
+        this._url = url || null;
+        this._scriptIdentifier = scriptIdentifier || null;
+        this._disabled = disabled || false;
+        this._condition = condition || "";
+        this._autoContinue = autoContinue || false;
+        this._actions = actions || [];
+        this._resolved = false;
+
+        this._sourceCodeLocation = location;
+        this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._sourceCodeLocationLocationChanged, this);
+        this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged, this._sourceCodeLocationDisplayLocationChanged, this);
+    }
 
     // Public
 
     get id()
     {
         return this._id;
-    },
+    }
 
     set id(id)
     {
         this._id = id || null;
-    },
+    }
 
     get url()
     {
         return this._url;
-    },
+    }
 
     get scriptIdentifier()
     {
         return this._scriptIdentifier;
-    },
+    }
 
     get sourceCodeLocation()
     {
         return this._sourceCodeLocation;
-    },
+    }
 
     get resolved()
     {
         return this._resolved;
-    },
+    }
 
     set resolved(resolved)
     {
@@ -135,12 +109,12 @@ WebInspector.Breakpoint.prototype = {
         this._resolved = resolved || false;
 
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ResolvedStateDidChange);
-    },
+    }
 
     get disabled()
     {
         return this._disabled;
-    },
+    }
 
     set disabled(disabled)
     {
@@ -150,12 +124,12 @@ WebInspector.Breakpoint.prototype = {
         this._disabled = disabled || false;
 
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.DisabledStateDidChange);
-    },
+    }
 
     get condition()
     {
         return this._condition;
-    },
+    }
 
     set condition(condition)
     {
@@ -165,12 +139,12 @@ WebInspector.Breakpoint.prototype = {
         this._condition = condition;
 
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ConditionDidChange);
-    },
+    }
 
     get autoContinue()
     {
         return this._autoContinue;
-    },
+    }
 
     set autoContinue(cont)
     {
@@ -180,12 +154,12 @@ WebInspector.Breakpoint.prototype = {
         this._autoContinue = cont;
 
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.AutoContinueDidChange);
-    },
+    }
 
     get actions()
     {
         return this._actions;
-    },
+    }
 
     get options()
     {
@@ -194,7 +168,7 @@ WebInspector.Breakpoint.prototype = {
             actions: this._serializableActions(),
             autoContinue: this._autoContinue
         };
-    },
+    }
 
     get info()
     {
@@ -208,16 +182,16 @@ WebInspector.Breakpoint.prototype = {
             actions: this._serializableActions(),
             autoContinue: this._autoContinue
         };
-    },
+    }
 
     get probeActions()
     {
         return this._actions.filter(function(action) {
             return action.type === WebInspector.BreakpointAction.Type.Probe;
         });
-    },
+    }
 
-    cycleToNextMode: function()
+    cycleToNextMode()
     {
         if (this.disabled) {
             // When cycling, clear auto-continue when going from disabled to enabled.
@@ -237,9 +211,9 @@ WebInspector.Breakpoint.prototype = {
         }
 
         this.disabled = true;
-    },
+    }
 
-    appendContextMenuItems: function(contextMenu, breakpointDisplayElement)
+    appendContextMenuItems(contextMenu, breakpointDisplayElement)
     {
         console.assert(document.body.contains(breakpointDisplayElement), "breakpoint popover display element must be in the DOM");
 
@@ -293,9 +267,9 @@ WebInspector.Breakpoint.prototype = {
             contextMenu.appendSeparator();
             contextMenu.appendItem(WebInspector.UIString("Reveal in Original Resource"), revealOriginalSourceCodeLocation.bind(this));
         }
-    },
+    }
 
-    createAction: function(type, precedingAction, data)
+    createAction(type, precedingAction, data)
     {
         var newAction = new WebInspector.BreakpointAction(this, type, data || null);
 
@@ -313,9 +287,9 @@ WebInspector.Breakpoint.prototype = {
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
 
         return newAction;
-    },
+    }
 
-    recreateAction: function(type, actionToReplace)
+    recreateAction(type, actionToReplace)
     {
         var newAction = new WebInspector.BreakpointAction(this, type, null);
 
@@ -329,9 +303,9 @@ WebInspector.Breakpoint.prototype = {
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
 
         return newAction;
-    },
+    }
 
-    removeAction: function(action)
+    removeAction(action)
     {
         var index = this._actions.indexOf(action);
         console.assert(index !== -1);
@@ -344,9 +318,9 @@ WebInspector.Breakpoint.prototype = {
             this.autoContinue = false;
 
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
-    },
+    }
 
-    clearActions: function(type)
+    clearActions(type)
     {
         if (!type)
             this._actions = [];
@@ -354,18 +328,18 @@ WebInspector.Breakpoint.prototype = {
             this._actions = this._actions.filter(function(action) { action.type !== type; });
 
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.Breakpoint.URLCookieKey] = this.url;
         cookie[WebInspector.Breakpoint.LineNumberCookieKey] = this.sourceCodeLocation.lineNumber;
         cookie[WebInspector.Breakpoint.ColumnNumberCookieKey] = this.sourceCodeLocation.columnNumber;
-    },
+    }
 
     // Protected (Called by BreakpointAction)
 
-    breakpointActionDidChange: function(action)
+    breakpointActionDidChange(action)
     {
         var index = this._actions.indexOf(action);
         console.assert(index !== -1);
@@ -373,43 +347,43 @@ WebInspector.Breakpoint.prototype = {
             return;
 
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
-    },
+    }
 
     // Private
 
-    _serializableActions: function()
+    _serializableActions()
     {
         var actions = [];
         for (var i = 0; i < this._actions.length; ++i)
             actions.push(this._actions[i].info);
         return actions;
-    },
+    }
 
-    _popoverToggleEnabledCheckboxChanged: function(event)
+    _popoverToggleEnabledCheckboxChanged(event)
     {
         this.disabled = !event.target.checked;
-    },
+    }
 
-    _popoverConditionInputChanged: function(event)
+    _popoverConditionInputChanged(event)
     {
         this.condition = event.target.value;
-    },
+    }
 
-    _popoverToggleAutoContinueCheckboxChanged: function(event)
+    _popoverToggleAutoContinueCheckboxChanged(event)
     {
         this.autoContinue = event.target.checked;
-    },
+    }
 
-    _popoverConditionInputKeyDown: function(event)
+    _popoverConditionInputKeyDown(event)
     {
         if (this._keyboardShortcutEsc.matchesEvent(event) || this._keyboardShortcutEnter.matchesEvent(event)) {
             this._popover.dismiss();
             event.stopPropagation();
             event.preventDefault();
         }
-    },
+    }
 
-    _editBreakpointPopoverContentElement: function()
+    _editBreakpointPopoverContentElement()
     {
         var content = this._popoverContentElement = document.createElement("div");
         content.className = WebInspector.Breakpoint.PopoverClassName;
@@ -478,9 +452,9 @@ WebInspector.Breakpoint.prototype = {
         content.appendChild(table);
 
         return content;
-    },
+    }
 
-    _popoverActionsCreateAddActionButton: function()
+    _popoverActionsCreateAddActionButton()
     {
         this._popoverContentElement.classList.remove(WebInspector.Breakpoint.WidePopoverClassName);
         this._actionsContainer.removeChildren();
@@ -488,9 +462,9 @@ WebInspector.Breakpoint.prototype = {
         var addActionButton = this._actionsContainer.appendChild(document.createElement("button"));
         addActionButton.textContent = WebInspector.UIString("Add Action");
         addActionButton.addEventListener("click", this._popoverActionsAddActionButtonClicked.bind(this));
-    },
+    }
 
-    _popoverActionsAddActionButtonClicked: function(event)
+    _popoverActionsAddActionButtonClicked(event)
     {
         this._popoverContentElement.classList.add(WebInspector.Breakpoint.WidePopoverClassName);
         this._actionsContainer.removeChildren();
@@ -500,9 +474,9 @@ WebInspector.Breakpoint.prototype = {
         this._popoverActionsInsertBreakpointActionView(newBreakpointActionView, -1);
         this._popoverOptionsRowElement.classList.remove(WebInspector.Breakpoint.HiddenStyleClassName);
         this._popover.update();
-    },
+    }
 
-    _popoverActionsInsertBreakpointActionView: function(breakpointActionView, index)
+    _popoverActionsInsertBreakpointActionView(breakpointActionView, index)
     {
         if (index === -1)
             this._actionsContainer.appendChild(breakpointActionView.element);
@@ -510,9 +484,9 @@ WebInspector.Breakpoint.prototype = {
             var nextElement = this._actionsContainer.children[index + 1] || null;
             this._actionsContainer.insertBefore(breakpointActionView.element, nextElement);
         }
-    },
+    }
 
-    breakpointActionViewAppendActionView: function(breakpointActionView, newAction)
+    breakpointActionViewAppendActionView(breakpointActionView, newAction)
     {
         var newBreakpointActionView = new WebInspector.BreakpointActionView(newAction, this);
 
@@ -529,9 +503,9 @@ WebInspector.Breakpoint.prototype = {
         this._popoverOptionsRowElement.classList.remove(WebInspector.Breakpoint.HiddenStyleClassName);
 
         this._popover.update();
-    },
+    }
 
-    breakpointActionViewRemoveActionView: function(breakpointActionView)
+    breakpointActionViewRemoveActionView(breakpointActionView)
     {
         breakpointActionView.element.remove();
 
@@ -542,14 +516,14 @@ WebInspector.Breakpoint.prototype = {
         }
 
         this._popover.update();
-    },
+    }
 
-    breakpointActionViewResized: function(breakpointActionView)
+    breakpointActionViewResized(breakpointActionView)
     {
         this._popover.update();
-    },
+    }
 
-    willDismissPopover: function(popover)
+    willDismissPopover(popover)
     {
         console.assert(this._popover === popover);
         delete this._popoverContentElement;
@@ -557,9 +531,9 @@ WebInspector.Breakpoint.prototype = {
         delete this._popoverOptionsCheckboxElement;
         delete this._actionsContainer;
         delete this._popover;
-    },
+    }
 
-    _showEditBreakpointPopover: function(boundingClientRect)
+    _showEditBreakpointPopover(boundingClientRect)
     {
         var bounds = WebInspector.Rect.rectFromClientRect(boundingClientRect);
         bounds.origin.x -= 1; // Move the anchor left one pixel so it looks more centered.
@@ -574,17 +548,38 @@ WebInspector.Breakpoint.prototype = {
         }
 
         document.getElementById(WebInspector.Breakpoint.PopoverConditionInputId).select();
-    },
+    }
 
-    _sourceCodeLocationLocationChanged: function(event)
+    _sourceCodeLocationLocationChanged(event)
     {
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.LocationDidChange, event.data);
-    },
+    }
 
-    _sourceCodeLocationDisplayLocationChanged: function(event)
+    _sourceCodeLocationDisplayLocationChanged(event)
     {
         this.dispatchEventToListeners(WebInspector.Breakpoint.Event.DisplayLocationDidChange, event.data);
     }
 };
 
-WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.Breakpoint.PopoverClassName = "edit-breakpoint-popover-content";
+WebInspector.Breakpoint.WidePopoverClassName = "wide";
+WebInspector.Breakpoint.PopoverConditionInputId = "edit-breakpoint-popover-condition";
+WebInspector.Breakpoint.PopoverOptionsAutoContinueInputId = "edit-breakpoint-popoover-auto-continue";
+WebInspector.Breakpoint.HiddenStyleClassName = "hidden";
+
+WebInspector.Breakpoint.DefaultBreakpointActionType = WebInspector.BreakpointAction.Type.Log;
+
+WebInspector.Breakpoint.TypeIdentifier = "breakpoint";
+WebInspector.Breakpoint.URLCookieKey = "breakpoint-url";
+WebInspector.Breakpoint.LineNumberCookieKey = "breakpoint-line-number";
+WebInspector.Breakpoint.ColumnNumberCookieKey = "breakpoint-column-number";
+
+WebInspector.Breakpoint.Event = {
+    DisabledStateDidChange: "breakpoint-disabled-state-did-change",
+    ResolvedStateDidChange: "breakpoint-resolved-state-did-change",
+    ConditionDidChange: "breakpoint-condition-did-change",
+    ActionsDidChange: "breakpoint-actions-did-change",
+    AutoContinueDidChange: "breakpoint-auto-continue-did-change",
+    LocationDidChange: "breakpoint-location-did-change",
+    DisplayLocationDidChange: "breakpoint-display-location-did-change",
+};
index a55a165..b94f792 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.BreakpointAction = function(breakpoint, typeOrInfo, data)
+WebInspector.BreakpointAction = class BreakpointAction extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    console.assert(breakpoint);
-    console.assert(typeOrInfo);
-
-    this._breakpoint = breakpoint;
+    constructor(breakpoint, typeOrInfo, data)
+    {
+        super();
 
-    if (typeof typeOrInfo === "string") {
-        this._type = typeOrInfo;
-        this._data = data || null;
-    } else if (typeof typeOrInfo === "object") {
-        this._type = typeOrInfo.type;
-        this._data = typeOrInfo.data || null;
-    } else
-        console.error("Unexpected type passed to WebInspector.BreakpointAction");
+        console.assert(breakpoint);
+        console.assert(typeOrInfo);
 
-    console.assert(typeof this._type === "string");
-    this._id = WebInspector.debuggerManager.nextBreakpointActionIdentifier;
-};
+        this._breakpoint = breakpoint;
 
-WebInspector.BreakpointAction.Type = {
-    Log: "log",
-    Evaluate: "evaluate",
-    Sound: "sound",
-    Probe: "probe"
-};
+        if (typeof typeOrInfo === "string") {
+            this._type = typeOrInfo;
+            this._data = data || null;
+        } else if (typeof typeOrInfo === "object") {
+            this._type = typeOrInfo.type;
+            this._data = typeOrInfo.data || null;
+        } else
+            console.error("Unexpected type passed to WebInspector.BreakpointAction");
 
-WebInspector.BreakpointAction.prototype = {
-    constructor: WebInspector.BreakpointAction,
-    __proto__: WebInspector.Object.prototype,
+        console.assert(typeof this._type === "string");
+        this._id = WebInspector.debuggerManager.nextBreakpointActionIdentifier;
+    }
 
     // Public
 
     get breakpoint()
     {
         return this._breakpoint;
-    },
+    }
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get type()
     {
         return this._type;
-    },
+    }
 
     get data()
     {
         return this._data;
-    },
+    }
 
     set data(data)
     {
@@ -86,7 +77,7 @@ WebInspector.BreakpointAction.prototype = {
         this._data = data;
 
         this._breakpoint.breakpointActionDidChange(this);
-    },
+    }
 
     get info()
     {
@@ -96,3 +87,10 @@ WebInspector.BreakpointAction.prototype = {
         return obj;
     }
 };
+
+WebInspector.BreakpointAction.Type = {
+    Log: "log",
+    Evaluate: "evaluate",
+    Sound: "sound",
+    Probe: "probe"
+};
index 36337d9..28421b3 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSCompletions = function(properties, acceptEmptyPrefix)
+WebInspector.CSSCompletions = class CSSCompletions
 {
-    this._values = [];
-    this._longhands = {};
-    this._shorthands = {};
-
-    for (var i = 0; i < properties.length; ++i) {
-        // COMPATIBILITY (iOS 6): This used to be an array of strings,
-        // now it contains objects with a 'name' property. Support both here.
-        var property = properties[i];
-        if (typeof property === "string") {
-            this._values.push(property);
-            continue;
-        }
+    constructor(properties, acceptEmptyPrefix)
+    {
+        this._values = [];
+        this._longhands = {};
+        this._shorthands = {};
 
-        var propertyName = property.name;
-        this._values.push(propertyName);
+        for (var i = 0; i < properties.length; ++i) {
+            // COMPATIBILITY (iOS 6): This used to be an array of strings,
+            // now it contains objects with a 'name' property. Support both here.
+            var property = properties[i];
+            if (typeof property === "string") {
+                this._values.push(property);
+                continue;
+            }
 
-        var longhands = property.longhands;
-        if (longhands) {
-            this._longhands[propertyName] = longhands;
+            var propertyName = property.name;
+            this._values.push(propertyName);
 
-            for (var j = 0; j < longhands.length; ++j) {
-                var longhandName = longhands[j];
+            var longhands = property.longhands;
+            if (longhands) {
+                this._longhands[propertyName] = longhands;
 
-                var shorthands = this._shorthands[longhandName];
-                if (!shorthands) {
-                    shorthands = [];
-                    this._shorthands[longhandName] = shorthands;
-                }
+                for (var j = 0; j < longhands.length; ++j) {
+                    var longhandName = longhands[j];
 
-                shorthands.push(propertyName);
+                    var shorthands = this._shorthands[longhandName];
+                    if (!shorthands) {
+                        shorthands = [];
+                        this._shorthands[longhandName] = shorthands;
+                    }
+
+                    shorthands.push(propertyName);
+                }
             }
         }
-    }
 
-    this._values.sort();
+        this._values.sort();
 
-    this._acceptEmptyPrefix = acceptEmptyPrefix;
-};
-
-WebInspector.CSSCompletions.cssNameCompletions = null;
+        this._acceptEmptyPrefix = acceptEmptyPrefix;
+    }
 
-WebInspector.CSSCompletions.requestCSSNameCompletions = function()
-{
-    if (WebInspector.CSSCompletions.cssNameCompletions)
-        return;
+    // Static
 
-    function propertyNamesCallback(error, names)
+    static requestCSSNameCompletions()
     {
-        if (error)
+        if (WebInspector.CSSCompletions.cssNameCompletions)
             return;
 
-        WebInspector.CSSCompletions.cssNameCompletions = new WebInspector.CSSCompletions(names, false);
+        function propertyNamesCallback(error, names)
+        {
+            if (error)
+                return;
 
-        WebInspector.CSSKeywordCompletions.addCustomCompletions(names);
+            WebInspector.CSSCompletions.cssNameCompletions = new WebInspector.CSSCompletions(names, false);
 
-        // CodeMirror is not included by tests so we shouldn't assume it always exists.
-        // If it isn't available we skip MIME type associations.
-        if (!window.CodeMirror)
-            return;
+            WebInspector.CSSKeywordCompletions.addCustomCompletions(names);
 
-        var propertyNamesForCodeMirror = {};
-        var valueKeywordsForCodeMirror = {"inherit": true, "initial": true};
-        var colorKeywordsForCodeMirror = {};
+            // CodeMirror is not included by tests so we shouldn't assume it always exists.
+            // If it isn't available we skip MIME type associations.
+            if (!window.CodeMirror)
+                return;
 
-        function nameForCodeMirror(name)
-        {
-            // CodeMirror parses the vendor prefix separate from the property or keyword name,
-            // so we need to strip vendor prefixes from our names. Also strip function parenthesis.
-            return name.replace(/^-[^-]+-/, "").replace(/\(\)$/, "");
-        }
+            var propertyNamesForCodeMirror = {};
+            var valueKeywordsForCodeMirror = {"inherit": true, "initial": true};
+            var colorKeywordsForCodeMirror = {};
 
-        function collectPropertyNameForCodeMirror(propertyName)
-        {
-            // Properties can also be value keywords, like when used in a transition.
-            // So we add them to both lists.
-            var codeMirrorPropertyName = nameForCodeMirror(propertyName);
-            propertyNamesForCodeMirror[codeMirrorPropertyName] = true;
-            valueKeywordsForCodeMirror[codeMirrorPropertyName] = true;
-        }
+            function nameForCodeMirror(name)
+            {
+                // CodeMirror parses the vendor prefix separate from the property or keyword name,
+                // so we need to strip vendor prefixes from our names. Also strip function parenthesis.
+                return name.replace(/^-[^-]+-/, "").replace(/\(\)$/, "");
+            }
 
-        for (var i = 0; i < names.length; ++i) {
-            // COMPATIBILITY (iOS 6): This used to be an array of strings,
-            // now it contains objects with a 'name' property. Support both here.
-            var property = names[i];
-            if (typeof property === "string")
-                collectPropertyNameForCodeMirror(property);
-            else
-                collectPropertyNameForCodeMirror(property.name);
-        }
+            function collectPropertyNameForCodeMirror(propertyName)
+            {
+                // Properties can also be value keywords, like when used in a transition.
+                // So we add them to both lists.
+                var codeMirrorPropertyName = nameForCodeMirror(propertyName);
+                propertyNamesForCodeMirror[codeMirrorPropertyName] = true;
+                valueKeywordsForCodeMirror[codeMirrorPropertyName] = true;
+            }
 
-        for (var propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap) {
-            var keywords = WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName];
-            for (var i = 0; i < keywords.length; ++i) {
-                // Skip numbers, like the ones defined for font-weight.
-                if (!isNaN(Number(keywords[i])))
-                    continue;
-                valueKeywordsForCodeMirror[nameForCodeMirror(keywords[i])] = true;
+            for (var i = 0; i < names.length; ++i) {
+                // COMPATIBILITY (iOS 6): This used to be an array of strings,
+                // now it contains objects with a 'name' property. Support both here.
+                var property = names[i];
+                if (typeof property === "string")
+                    collectPropertyNameForCodeMirror(property);
+                else
+                    collectPropertyNameForCodeMirror(property.name);
             }
-        }
 
-        WebInspector.CSSKeywordCompletions._colors.forEach(function(colorName) {
-            colorKeywordsForCodeMirror[nameForCodeMirror(colorName)] = true;
-        });
+            for (var propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap) {
+                var keywords = WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName];
+                for (var i = 0; i < keywords.length; ++i) {
+                    // Skip numbers, like the ones defined for font-weight.
+                    if (!isNaN(Number(keywords[i])))
+                        continue;
+                    valueKeywordsForCodeMirror[nameForCodeMirror(keywords[i])] = true;
+                }
+            }
 
-        function updateCodeMirrorCSSMode(mimeType)
-        {
-            var modeSpec = CodeMirror.resolveMode(mimeType);
+            WebInspector.CSSKeywordCompletions._colors.forEach(function(colorName) {
+                colorKeywordsForCodeMirror[nameForCodeMirror(colorName)] = true;
+            });
 
-            console.assert(modeSpec.propertyKeywords);
-            console.assert(modeSpec.valueKeywords);
-            console.assert(modeSpec.colorKeywords);
+            function updateCodeMirrorCSSMode(mimeType)
+            {
+                var modeSpec = CodeMirror.resolveMode(mimeType);
 
-            modeSpec.propertyKeywords = propertyNamesForCodeMirror;
-            modeSpec.valueKeywords = valueKeywordsForCodeMirror;
-            modeSpec.colorKeywords = colorKeywordsForCodeMirror;
+                console.assert(modeSpec.propertyKeywords);
+                console.assert(modeSpec.valueKeywords);
+                console.assert(modeSpec.colorKeywords);
 
-            CodeMirror.defineMIME(mimeType, modeSpec);
+                modeSpec.propertyKeywords = propertyNamesForCodeMirror;
+                modeSpec.valueKeywords = valueKeywordsForCodeMirror;
+                modeSpec.colorKeywords = colorKeywordsForCodeMirror;
+
+                CodeMirror.defineMIME(mimeType, modeSpec);
+            }
+
+            updateCodeMirrorCSSMode("text/css");
+            updateCodeMirrorCSSMode("text/x-scss");
         }
 
-        updateCodeMirrorCSSMode("text/css");
-        updateCodeMirrorCSSMode("text/x-scss");
+        if (window.CSSAgent)
+            CSSAgent.getSupportedCSSProperties(propertyNamesCallback);
     }
 
-    if (window.CSSAgent)
-        CSSAgent.getSupportedCSSProperties(propertyNamesCallback);
-};
+    // Public
 
-WebInspector.CSSCompletions.prototype = {
     get values()
     {
         return this._values;
-    },
+    }
 
-    startsWith: function(prefix)
+    startsWith(prefix)
     {
         var firstIndex = this._firstIndexOfPrefix(prefix);
         if (firstIndex === -1)
@@ -176,15 +179,15 @@ WebInspector.CSSCompletions.prototype = {
         while (firstIndex < this._values.length && this._values[firstIndex].startsWith(prefix))
             results.push(this._values[firstIndex++]);
         return results;
-    },
+    }
 
-    firstStartsWith: function(prefix)
+    firstStartsWith(prefix)
     {
         var foundIndex = this._firstIndexOfPrefix(prefix);
         return (foundIndex === -1 ? "" : this._values[foundIndex]);
-    },
+    }
 
-    _firstIndexOfPrefix: function(prefix)
+    _firstIndexOfPrefix(prefix)
     {
         if (!this._values.length)
             return -1;
@@ -214,26 +217,26 @@ WebInspector.CSSCompletions.prototype = {
             foundIndex--;
 
         return foundIndex;
-    },
+    }
 
-    keySet: function()
+    keySet()
     {
         if (!this._keySet)
             this._keySet = this._values.keySet();
         return this._keySet;
-    },
+    }
 
-    next: function(str, prefix)
+    next(str, prefix)
     {
         return this._closest(str, prefix, 1);
-    },
+    }
 
-    previous: function(str, prefix)
+    previous(str, prefix)
     {
         return this._closest(str, prefix, -1);
-    },
+    }
 
-    _closest: function(str, prefix, shift)
+    _closest(str, prefix, shift)
     {
         if (!str)
             return "";
@@ -251,25 +254,27 @@ WebInspector.CSSCompletions.prototype = {
         var j = propertiesWithPrefix.indexOf(str);
         j = (j + propertiesWithPrefix.length + shift) % propertiesWithPrefix.length;
         return propertiesWithPrefix[j];
-    },
+    }
 
-    isShorthandPropertyName: function(shorthand)
+    isShorthandPropertyName(shorthand)
     {
         return shorthand in this._longhands;
-    },
+    }
 
-    isLonghandPropertyName: function(longhand)
+    isLonghandPropertyName(longhand)
     {
         return longhand in this._shorthands;
-    },
+    }
 
-    longhandsForShorthand: function(shorthand)
+    longhandsForShorthand(shorthand)
     {
         return this._longhands[shorthand] || [];
-    },
+    }
 
-    shorthandsForLonghand: function(longhand)
+    shorthandsForLonghand(longhand)
     {
         return this._shorthands[longhand] || [];
     }
 };
+
+WebInspector.CSSCompletions.cssNameCompletions = null;
index a8c4287..ac2dee8 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSMedia = function(type, text, sourceCodeLocation)
+WebInspector.CSSMedia = class CSSMedia extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._type = type || null;
-    this._text = text || "";
-    this._sourceCodeLocation = sourceCodeLocation || null;
-};
+    constructor(type, text, sourceCodeLocation)
+    {
+        super();
 
-WebInspector.CSSMedia.Type = {
-    MediaRule: "css-media-type-media-rule",
-    ImportRule: "css-media-type-import-rule",
-    LinkedStyleSheet: "css-media-type-linked-stylesheet",
-    InlineStyleSheet: "css-media-type-inline-stylesheet"
-};
+        console.assert(!sourceCodeLocation || sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
 
-WebInspector.CSSMedia.prototype = {
-    constructor: WebInspector.CSSMedia,
+        this._type = type || null;
+        this._text = text || "";
+        this._sourceCodeLocation = sourceCodeLocation || null;
+    }
 
     // Public
 
     get type()
     {
         return this._type;
-    },
+    }
 
     get text()
     {
         return this._text;
-    },
+    }
 
     get sourceCodeLocation()
     {
@@ -60,4 +54,9 @@ WebInspector.CSSMedia.prototype = {
     }
 };
 
-WebInspector.CSSMedia.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.CSSMedia.Type = {
+    MediaRule: "css-media-type-media-rule",
+    ImportRule: "css-media-type-import-rule",
+    LinkedStyleSheet: "css-media-type-linked-stylesheet",
+    InlineStyleSheet: "css-media-type-inline-stylesheet"
+};
index 0bc8f94..22d6507 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSProperty = function(index, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange, styleDeclarationTextRange)
+WebInspector.CSSProperty = class CSSProperty extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._ownerStyle = null;
-    this._index = index;
-
-    this.update(text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange, styleDeclarationTextRange, true);
-};
-
-WebInspector.Object.addConstructorFunctions(WebInspector.CSSProperty);
+    constructor(index, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange, styleDeclarationTextRange)
+    {
+        super();
 
-WebInspector.CSSProperty.Event = {
-    Changed: "css-property-changed",
-    OverriddenStatusChanged: "css-property-overridden-status-changed"
-};
+        this._ownerStyle = null;
+        this._index = index;
 
-WebInspector.CSSProperty.prototype = {
-    constructor: WebInspector.CSSProperty,
-    __proto__: WebInspector.Object.prototype,
+        this.update(text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange, styleDeclarationTextRange, true);
+    }
 
     // Public
 
     get ownerStyle()
     {
         return this._ownerStyle;
-    },
+    }
 
     set ownerStyle(ownerStyle)
     {
         this._ownerStyle = ownerStyle || null;
-    },
+    }
 
     get index()
     {
         return this._index;
-    },
+    }
 
     set index(index)
     {
         this._index = index;
-    },
+    }
 
-    update: function(text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange, styleDeclarationTextRange, dontFireEvents)
+    update(text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange, styleDeclarationTextRange, dontFireEvents)
     {
         text = text || "";
         name = name || "";
@@ -116,7 +107,7 @@ WebInspector.CSSProperty.prototype = {
 
         if (changed)
             this.dispatchEventToListeners(WebInspector.CSSProperty.Event.Changed);
-    },
+    }
 
     get synthesizedText()
     {
@@ -126,17 +117,17 @@ WebInspector.CSSProperty.prototype = {
 
         var priority = this.priority;
         return name + ": " + this.value.trim() + (priority ? " !" + priority : "") + ";";
-    },
+    }
 
     get text()
     {
         return this._text || this.synthesizedText;
-    },
+    }
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get canonicalName()
     {
@@ -146,32 +137,32 @@ WebInspector.CSSProperty.prototype = {
         this._canonicalName = WebInspector.cssStyleManager.canonicalNameForPropertyName(this.name);
 
         return this._canonicalName;
-    },
+    }
 
     get value()
     {
         return this._value;
-    },
+    }
 
     get important()
     {
         return this.priority === "important";
-    },
+    }
 
     get priority()
     {
         return this._priority;
-    },
+    }
 
     get enabled()
     {
         return this._enabled && this._ownerStyle && (!isNaN(this._index) || this._ownerStyle.type === WebInspector.CSSStyleDeclaration.Type.Computed);
-    },
+    }
 
     get overridden()
     {
         return this._overridden;
-    },
+    }
 
     set overridden(overridden)
     {
@@ -198,32 +189,32 @@ WebInspector.CSSProperty.prototype = {
         }
 
         this._overriddenStatusChangedTimeout = setTimeout(delayed.bind(this), 0);
-    },
+    }
 
     get implicit()
     {
         return this._implicit;
-    },
+    }
 
     get anonymous()
     {
         return this._anonymous;
-    },
+    }
 
     get inherited()
     {
         return this._inherited;
-    },
+    }
 
     get valid()
     {
         return this._valid;
-    },
+    }
 
     get styleSheetTextRange()
     {
         return this._styleSheetTextRange;
-    },
+    }
 
     get styleDeclarationTextRange()
     {
@@ -251,34 +242,34 @@ WebInspector.CSSProperty.prototype = {
         this._styleDeclarationTextRange = new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
 
         return this._styleDeclarationTextRange;
-    },
+    }
 
     get relatedShorthandProperty()
     {
         return this._relatedShorthandProperty;
-    },
+    }
 
     set relatedShorthandProperty(property)
     {
         this._relatedShorthandProperty = property || null;
-    },
+    }
 
     get relatedLonghandProperties()
     {
         return this._relatedLonghandProperties;
-    },
+    }
 
-    addRelatedLonghandProperty: function(property)
+    addRelatedLonghandProperty(property)
     {
         this._relatedLonghandProperties.push(property);
-    },
+    }
 
-    clearRelatedLonghandProperties: function(property)
+    clearRelatedLonghandProperties(property)
     {
         this._relatedLonghandProperties = [];
-    },
+    }
 
-    hasOtherVendorNameOrKeyword: function()
+    hasOtherVendorNameOrKeyword()
     {
         if ("_hasOtherVendorNameOrKeyword" in this)
             return this._hasOtherVendorNameOrKeyword;
@@ -288,3 +279,8 @@ WebInspector.CSSProperty.prototype = {
         return this._hasOtherVendorNameOrKeyword;
     }
 };
+
+WebInspector.CSSProperty.Event = {
+    Changed: "css-property-changed",
+    OverriddenStatusChanged: "css-property-overridden-status-changed"
+};
index 0d87410..6f3873b 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSRule = function(nodeStyles, ownerStyleSheet, id, type, sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList)
+WebInspector.CSSRule = class CSSRule extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    console.assert(nodeStyles);
-    this._nodeStyles = nodeStyles;
-
-    this._ownerStyleSheet = ownerStyleSheet || null;
-    this._id = id || null;
-    this._type = type || null;
+    constructor(nodeStyles, ownerStyleSheet, id, type, sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList)
+    {
+        super();
 
-    this.update(sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList, true);
-};
+        console.assert(nodeStyles);
+        this._nodeStyles = nodeStyles;
 
-WebInspector.Object.addConstructorFunctions(WebInspector.CSSRule);
+        this._ownerStyleSheet = ownerStyleSheet || null;
+        this._id = id || null;
+        this._type = type || null;
 
-WebInspector.CSSRule.Event = {
-    Changed: "css-rule-changed"
-};
-
-WebInspector.CSSRule.Type = {
-    Author: "css-rule-type-author",
-    User: "css-rule-type-user",
-    UserAgent: "css-rule-type-user-agent",
-    Inspector: "css-rule-type-inspector"
-};
-
-WebInspector.CSSRule.prototype = {
-    constructor: WebInspector.CSSRule,
+        this.update(sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList, true);
+    }
 
     // Public
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get ownerStyleSheet()
     {
         return this._ownerStyleSheet;
-    },
+    }
 
     get editable()
     {
         return !!this._id && (this._type === WebInspector.CSSRule.Type.Author || this._type === WebInspector.CSSRule.Type.Inspector);
-    },
+    }
 
-    update: function(sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList, dontFireEvents)
+    update(sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList, dontFireEvents)
     {
         sourceCodeLocation = sourceCodeLocation || null;
         selectorText = selectorText || "";
@@ -105,22 +91,22 @@ WebInspector.CSSRule.prototype = {
 
         if (changed)
             this.dispatchEventToListeners(WebInspector.CSSRule.Event.Changed);
-    },
+    }
 
     get type()
     {
         return this._type;
-    },
+    }
 
     get sourceCodeLocation()
     {
         return this._sourceCodeLocation;
-    },
+    }
 
     get selectorText()
     {
         return this._selectorText;
-    },
+    }
 
     set selectorText(selectorText)
     {
@@ -132,17 +118,17 @@ WebInspector.CSSRule.prototype = {
             return;
 
         this._nodeStyles.changeRuleSelector(this, selectorText);
-    },
+    }
 
     get selectors()
     {
         return this._selectors;
-    },
+    }
 
     get matchedSelectorIndices()
     {
         return this._matchedSelectorIndices;
-    },
+    }
 
     get matchedSelectors()
     {
@@ -160,7 +146,7 @@ WebInspector.CSSRule.prototype = {
         }, this);
 
         return this._matchedSelectors;
-    },
+    }
 
     get matchedSelectorText()
     {
@@ -176,25 +162,25 @@ WebInspector.CSSRule.prototype = {
         this._matchedSelectorText = this.matchedSelectors.map(function(x) { return x.text; }).join(", ");
 
         return this._matchedSelectorText;
-    },
+    }
 
     get style()
     {
         return this._style;
-    },
+    }
 
     get mediaList()
     {
         return this._mediaList;
-    },
+    }
 
-    isEqualTo: function(rule)
+    isEqualTo(rule)
     {
         if (!rule)
             return false;
 
         return Object.shallowEqual(this._id, rule.id);
-    },
+    }
 
     // Protected
 
@@ -204,4 +190,13 @@ WebInspector.CSSRule.prototype = {
     }
 };
 
-WebInspector.CSSRule.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.CSSRule.Event = {
+    Changed: "css-rule-changed"
+};
+
+WebInspector.CSSRule.Type = {
+    Author: "css-rule-type-author",
+    User: "css-rule-type-user",
+    UserAgent: "css-rule-type-user-agent",
+    Inspector: "css-rule-type-inspector"
+};
index ff2970b..4a62623 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSSelector = function(text, specificity, dynamic)
+WebInspector.CSSSelector = class CSSSelector extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    console.assert(text);
+    constructor(text, specificity, dynamic)
+    {
+        super();
 
-    this._text = text;
-    this._specificity = specificity || null;
-    this._dynamic = dynamic || false;
-};
+        console.assert(text);
 
-WebInspector.CSSSelector.prototype = {
-    constructor: WebInspector.CSSSelector,
-    __proto__: WebInspector.Object.prototype,
+        this._text = text;
+        this._specificity = specificity || null;
+        this._dynamic = dynamic || false;
+    }
 
     // Public
 
     get text()
     {
         return this._text;
-    },
+    }
 
     get specificity()
     {
         return this._specificity;
-    },
+    }
 
     get dynamic()
     {
index ec059e1..fb0c63e 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleDeclaration = function(nodeStyles, ownerStyleSheet, id, type, node, inherited, text, properties, styleSheetTextRange)
+WebInspector.CSSStyleDeclaration = class CSSStyleDeclaration extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    console.assert(nodeStyles);
-    this._nodeStyles = nodeStyles;
-
-    this._ownerRule = null;
-
-    this._ownerStyleSheet = ownerStyleSheet || null;
-    this._id = id || null;
-    this._type = type || null;
-    this._node = node || null;
-    this._inherited = inherited || false;
+    constructor(nodeStyles, ownerStyleSheet, id, type, node, inherited, text, properties, styleSheetTextRange)
+    {
+        super();
 
-    this._pendingProperties = [];
-    this._propertyNameMap = {};
+        console.assert(nodeStyles);
+        this._nodeStyles = nodeStyles;
 
-    this.update(text, properties, styleSheetTextRange, true);
-};
+        this._ownerRule = null;
 
-WebInspector.Object.addConstructorFunctions(WebInspector.CSSStyleDeclaration);
+        this._ownerStyleSheet = ownerStyleSheet || null;
+        this._id = id || null;
+        this._type = type || null;
+        this._node = node || null;
+        this._inherited = inherited || false;
 
-WebInspector.CSSStyleDeclaration.Event = {
-    PropertiesChanged: "css-style-declaration-properties-changed"
-};
-
-WebInspector.CSSStyleDeclaration.Type = {
-    Rule: "css-style-declaration-type-rule",
-    Inline: "css-style-declaration-type-inline",
-    Attribute: "css-style-declaration-type-attribute",
-    Computed: "css-style-declaration-type-computed"
-};
+        this._pendingProperties = [];
+        this._propertyNameMap = {};
 
-WebInspector.CSSStyleDeclaration.prototype = {
-    constructor: WebInspector.CSSStyleDeclaration,
-    __proto__: WebInspector.Object.prototype,
+        this.update(text, properties, styleSheetTextRange, true);
+    }
 
     // Public
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get ownerStyleSheet()
     {
         return this._ownerStyleSheet;
-    },
+    }
 
     get type()
     {
         return this._type;
-    },
+    }
 
     get inherited()
     {
         return this._inherited;
-    },
+    }
 
     get node()
     {
         return this._node;
-    },
+    }
 
     get editable()
     {
@@ -100,9 +85,9 @@ WebInspector.CSSStyleDeclaration.prototype = {
             return !this._node.isInShadowTree();
 
         return false;
-    },
+    }
 
-    update: function(text, properties, styleSheetTextRange, dontFireEvents)
+    update(text, properties, styleSheetTextRange, dontFireEvents)
     {
         text = text || "";
         properties = properties || [];
@@ -176,22 +161,22 @@ WebInspector.CSSStyleDeclaration.prototype = {
 
         // Delay firing the PropertiesChanged event so DOMNodeStyles has a chance to mark overridden and associated properties.
         setTimeout(delayed.bind(this), 0);
-    },
+    }
 
     get ownerRule()
     {
         return this._ownerRule;
-    },
+    }
 
     set ownerRule(rule)
     {
         this._ownerRule = rule || null;
-    },
+    }
 
     get text()
     {
         return this._text;
-    },
+    }
 
     set text(text)
     {
@@ -199,12 +184,12 @@ WebInspector.CSSStyleDeclaration.prototype = {
             return;
 
         this._nodeStyles.changeStyleText(this, text);
-    },
+    }
 
     get properties()
     {
         return this._properties;
-    },
+    }
 
     get visibleProperties()
     {
@@ -216,19 +201,19 @@ WebInspector.CSSStyleDeclaration.prototype = {
         });
 
         return this._visibleProperties;
-    },
+    }
 
     get pendingProperties()
     {
         return this._pendingProperties;
-    },
+    }
 
     get styleSheetTextRange()
     {
         return this._styleSheetTextRange;
-    },
+    }
 
-    propertyForName: function(name, dontCreateIfMissing)
+    propertyForName(name, dontCreateIfMissing)
     {
         console.assert(name);
         if (!name)
@@ -273,7 +258,7 @@ WebInspector.CSSStyleDeclaration.prototype = {
         this._pendingProperties.push(newProperty);
 
         return newProperty;
-    },
+    }
 
     // Protected
 
@@ -282,3 +267,14 @@ WebInspector.CSSStyleDeclaration.prototype = {
         return this._nodeStyles;
     }
 };
+
+WebInspector.CSSStyleDeclaration.Event = {
+    PropertiesChanged: "css-style-declaration-properties-changed"
+};
+
+WebInspector.CSSStyleDeclaration.Type = {
+    Rule: "css-style-declaration-type-rule",
+    Inline: "css-style-declaration-type-inline",
+    Attribute: "css-style-declaration-type-attribute",
+    Computed: "css-style-declaration-type-computed"
+};
index 0fe3227..6c9c6b9 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleSheet = function(id, url, parentFrame)
+WebInspector.CSSStyleSheet = class CSSStyleSheet extends WebInspector.SourceCode
 {
-    WebInspector.SourceCode.call(this);
-
-    console.assert(id);
-
-    this._id = id || null;
-
-    this.updateInfo(url, parentFrame);
-};
+    constructor(id, url, parentFrame)
+    {
+        super();
 
-WebInspector.Object.addConstructorFunctions(WebInspector.CSSStyleSheet);
+        console.assert(id);
 
-WebInspector.CSSStyleSheet.resetUniqueDisplayNameNumbers = function()
-{
-    WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber = 1;
-};
+        this._id = id || null;
 
-WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber = 1;
+        this.updateInfo(url, parentFrame);
+    }
 
-WebInspector.CSSStyleSheet.Event = {
-    ContentDidChange: "stylesheet-content-did-change"
-};
+    // Static
 
-WebInspector.CSSStyleSheet.prototype = {
-    constructor: WebInspector.CSSStyleSheet,
-    __proto__: WebInspector.SourceCode.prototype,
+    static resetUniqueDisplayNameNumbers()
+    {
+        WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber = 1;
+    }
 
     // Public
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get parentFrame()
     {
         return this._parentFrame;
-    },
+    }
 
     get url()
     {
         return this._url;
-    },
+    }
 
     get urlComponents()
     {
         if (!this._urlComponents)
             this._urlComponents = parseURL(this._url);
         return this._urlComponents;
-    },
+    }
 
     get mimeType()
     {
         return "text/css";
-    },
+    }
 
     get displayName()
     {
@@ -90,24 +82,24 @@ WebInspector.CSSStyleSheet.prototype = {
             this._uniqueDisplayNameNumber = this.constructor._nextUniqueDisplayNameNumber++;
 
         return WebInspector.UIString("Anonymous StyleSheet %d").format(this._uniqueDisplayNameNumber);
-    },
+    }
 
     // Protected
 
-    updateInfo: function(url, parentFrame)
+    updateInfo(url, parentFrame)
     {
         this._url = url || null;
         delete this._urlComponents;
 
         this._parentFrame = parentFrame || null;
-    },
+    }
 
     get revisionForRequestedContent()
     {
         return this.currentRevision;
-    },
+    }
 
-    handleCurrentRevisionContentChange: function()
+    handleCurrentRevisionContentChange()
     {
         if (!this._id)
             return;
@@ -125,9 +117,9 @@ WebInspector.CSSStyleSheet.prototype = {
         this._ignoreNextContentDidChangeNotification = true;
 
         CSSAgent.setStyleSheetText(this._id, this.currentRevision.content, contentDidChange.bind(this));
-    },
+    }
 
-    requestContentFromBackend: function()
+    requestContentFromBackend()
     {
         if (!this._id) {
             // There is no identifier to request content with. Reject the promise to cause the
@@ -136,9 +128,9 @@ WebInspector.CSSStyleSheet.prototype = {
         }
 
         return CSSAgent.getStyleSheetText(this._id);
-    },
+    }
 
-    noteContentDidChange: function()
+    noteContentDidChange()
     {
         if (this._ignoreNextContentDidChangeNotification) {
             delete this._ignoreNextContentDidChangeNotification;
@@ -150,3 +142,9 @@ WebInspector.CSSStyleSheet.prototype = {
         return true;
     }
 };
+
+WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber = 1;
+
+WebInspector.CSSStyleSheet.Event = {
+    ContentDidChange: "stylesheet-content-did-change"
+};
index 1932675..5a65e00 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CallFrame = function(id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode)
+WebInspector.CallFrame = class CallFrame extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    console.assert(!sourceCodeLocation || sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
-    console.assert(!thisObject || thisObject instanceof WebInspector.RemoteObject);
-    console.assert(!scopeChain || scopeChain instanceof Array);
-
-    this._id = id || null;
-    this._sourceCodeLocation = sourceCodeLocation || null;
-    this._functionName = functionName || null;
-    this._thisObject = thisObject || null;
-    this._scopeChain = scopeChain || [];
-    this._nativeCode = nativeCode || false;
-};
-
-WebInspector.CallFrame.prototype = {
-    constructor: WebInspector.CallFrame,
+    constructor(id, sourceCodeLocation, functionName, thisObject, scopeChain, nativeCode)
+    {
+        super();
+
+        console.assert(!sourceCodeLocation || sourceCodeLocation instanceof WebInspector.SourceCodeLocation);
+        console.assert(!thisObject || thisObject instanceof WebInspector.RemoteObject);
+        console.assert(!scopeChain || scopeChain instanceof Array);
+
+        this._id = id || null;
+        this._sourceCodeLocation = sourceCodeLocation || null;
+        this._functionName = functionName || null;
+        this._thisObject = thisObject || null;
+        this._scopeChain = scopeChain || [];
+        this._nativeCode = nativeCode || false;
+    }
 
     // Public
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get sourceCodeLocation()
     {
         return this._sourceCodeLocation;
-    },
+    }
 
     get functionName()
     {
         return this._functionName;
-    },
+    }
 
     get nativeCode()
     {
         return this._nativeCode;
-    },
+    }
 
     get thisObject()
     {
         return this._thisObject;
-    },
+    }
 
     get scopeChain()
     {
         return this._scopeChain;
-    },
+    }
 
-    saveIdentityToCookie: function()
+    saveIdentityToCookie()
     {
         // Do nothing. The call frame is torn down when the inspector closes, and
         // we shouldn't restore call frame content views across debugger pauses.
-    },
+    }
 
-    collectScopeChainVariableNames: function(callback)
+    collectScopeChainVariableNames(callback)
     {
         var result = {this: true};
 
@@ -101,5 +100,3 @@ WebInspector.CallFrame.prototype = {
             this._scopeChain[i].object.deprecatedGetAllProperties(propertiesCollected);
     }
 };
-
-WebInspector.CallFrame.prototype.__proto__ = WebInspector.Object.prototype;
index 1dbb36d..799dad0 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CollectionEntry = function(key, value)
+WebInspector.CollectionEntry = class CollectionEntry extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
+    constructor(key, value)
+    {
+        super();
 
-    console.assert(value instanceof WebInspector.RemoteObject);
-    console.assert(!key || key instanceof WebInspector.RemoteObject);
+        console.assert(value instanceof WebInspector.RemoteObject);
+        console.assert(!key || key instanceof WebInspector.RemoteObject);
 
-    this._key = key;
-    this._value = value;
-};
+        this._key = key;
+        this._value = value;
+    }
 
-// Runtime.CollectionEntry.
-WebInspector.CollectionEntry.fromPayload = function(payload)
-{
-    if (payload.key)
-        payload.key = WebInspector.RemoteObject.fromPayload(payload.key);
-    if (payload.value)
-        payload.value = WebInspector.RemoteObject.fromPayload(payload.value);
+    // Static
 
-    return new WebInspector.CollectionEntry(payload.key, payload.value);
-};
+    // Runtime.CollectionEntry.
+    static fromPayload(payload)
+    {
+        if (payload.key)
+            payload.key = WebInspector.RemoteObject.fromPayload(payload.key);
+        if (payload.value)
+            payload.value = WebInspector.RemoteObject.fromPayload(payload.value);
 
-WebInspector.CollectionEntry.prototype = {
-    constructor: WebInspector.CollectionEntry,
-    __proto__: WebInspector.Object.prototype,
+        return new WebInspector.CollectionEntry(payload.key, payload.value);
+    }
 
     // Public
 
     get key()
     {
         return this._key;
-    },
+    }
 
     get value()
     {
index dd3afbc..8e113c9 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CollectionEntryPreview = function(keyPreview, valuePreview)
+WebInspector.CollectionEntryPreview = class CollectionEntryPreview extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
+    constructor(keyPreview, valuePreview)
+    {
+        super();
 
-    console.assert(valuePreview instanceof WebInspector.ObjectPreview);
-    console.assert(!keyPreview || keyPreview instanceof WebInspector.ObjectPreview);
+        console.assert(valuePreview instanceof WebInspector.ObjectPreview);
+        console.assert(!keyPreview || keyPreview instanceof WebInspector.ObjectPreview);
 
-    this._key = keyPreview;
-    this._value = valuePreview;
-};
+        this._key = keyPreview;
+        this._value = valuePreview;
+    }
 
-// Runtime.EntryPreview.
-WebInspector.CollectionEntryPreview.fromPayload = function(payload)
-{
-    if (payload.key)
-        payload.key = WebInspector.ObjectPreview.fromPayload(payload.key);
-    if (payload.value)
-        payload.value = WebInspector.ObjectPreview.fromPayload(payload.value);
+    // Static
 
-    return new WebInspector.CollectionEntryPreview(payload.key, payload.value);
-};
+    // Runtime.EntryPreview.
+    static fromPayload(payload)
+    {
+        if (payload.key)
+            payload.key = WebInspector.ObjectPreview.fromPayload(payload.key);
+        if (payload.value)
+            payload.value = WebInspector.ObjectPreview.fromPayload(payload.value);
 
-WebInspector.CollectionEntryPreview.prototype = {
-    constructor: WebInspector.CollectionEntryPreview,
-    __proto__: WebInspector.Object.prototype,
+        return new WebInspector.CollectionEntryPreview(payload.key, payload.value);
+    }
 
     // Public
 
     get keyPreview()
     {
         return this._key;
-    },
+    }
 
     get valuePreview()
     {
index fde1973..8f3be6c 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Color = function(format, components)
+WebInspector.Color = class Color
 {
-    this.format = format;
-    if (format === WebInspector.Color.Format.HSL || format === WebInspector.Color.Format.HSLA)
-        this._hsla = components;
-    else
-        this._rgba = components;
-
-    this.valid = !components.some(function(component) {
-        return isNaN(component);
-    });
-};
+    constructor(format, components)
+    {
+        this.format = format;
 
-WebInspector.Color.Format = {
-    Original: "color-format-original",
-    Nickname: "color-format-nickname",
-    HEX: "color-format-hex",
-    ShortHEX: "color-format-short-hex",
-    RGB: "color-format-rgb",
-    RGBA: "color-format-rgba",
-    HSL: "color-format-hsl",
-    HSLA: "color-format-hsla"
-};
+        if (format === WebInspector.Color.Format.HSL || format === WebInspector.Color.Format.HSLA)
+            this._hsla = components;
+        else
+            this._rgba = components;
 
-WebInspector.Color.fromString = function(colorString)
-{
-    var value = colorString.toLowerCase().replace(/%|\s+/g, "");
-    const transparentNicknames = ["transparent", "rgba(0,0,0,0)", "hsla(0,0,0,0)"];
-    if (transparentNicknames.contains(value)) {
-        var color = new WebInspector.Color(WebInspector.Color.Format.Nickname, [0, 0, 0, 0]);
-        color.nickname = "transparent";
-        color.original = colorString;
-        return color;
+        this.valid = !components.some(function(component) {
+            return isNaN(component);
+        });
     }
 
-    // Simple - #hex, rgb(), nickname, hsl()
-    var simple = /^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;
-    var match = colorString.match(simple);
-    if (match) {
-        if (match[1]) { // hex
-            var hex = match[1].toUpperCase();
-            if (hex.length === 3) {
-                return new WebInspector.Color(WebInspector.Color.Format.ShortHEX, [
-                    parseInt(hex.charAt(0) + hex.charAt(0), 16),
-                    parseInt(hex.charAt(1) + hex.charAt(1), 16),
-                    parseInt(hex.charAt(2) + hex.charAt(2), 16),
+    // Static
+
+    static fromString(colorString)
+    {
+        var value = colorString.toLowerCase().replace(/%|\s+/g, "");
+        var transparentNicknames = ["transparent", "rgba(0,0,0,0)", "hsla(0,0,0,0)"];
+        if (transparentNicknames.contains(value)) {
+            var color = new WebInspector.Color(WebInspector.Color.Format.Nickname, [0, 0, 0, 0]);
+            color.nickname = "transparent";
+            color.original = colorString;
+            return color;
+        }
+
+        // Simple - #hex, rgb(), nickname, hsl()
+        var simple = /^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;
+        var match = colorString.match(simple);
+        if (match) {
+            if (match[1]) { // hex
+                var hex = match[1].toUpperCase();
+                if (hex.length === 3) {
+                    return new WebInspector.Color(WebInspector.Color.Format.ShortHEX, [
+                        parseInt(hex.charAt(0) + hex.charAt(0), 16),
+                        parseInt(hex.charAt(1) + hex.charAt(1), 16),
+                        parseInt(hex.charAt(2) + hex.charAt(2), 16),
+                        1
+                    ]);
+                } else {
+                    return new WebInspector.Color(WebInspector.Color.Format.HEX, [
+                        parseInt(hex.substring(0, 2), 16),
+                        parseInt(hex.substring(2, 4), 16),
+                        parseInt(hex.substring(4, 6), 16),
+                        1
+                    ]);
+                }
+            } else if (match[2]) { // rgb
+                var rgb = match[2].split(/\s*,\s*/);
+                return new WebInspector.Color(WebInspector.Color.Format.RGB, [
+                    parseInt(rgb[0]),
+                    parseInt(rgb[1]),
+                    parseInt(rgb[2]),
                     1
                 ]);
-            } else {
-                return new WebInspector.Color(WebInspector.Color.Format.HEX, [
-                    parseInt(hex.substring(0, 2), 16),
-                    parseInt(hex.substring(2, 4), 16),
-                    parseInt(hex.substring(4, 6), 16),
+            } else if (match[3]) { // nickname
+                var nickname = match[3].toLowerCase();
+                if (WebInspector.Color.Nicknames.hasOwnProperty(nickname)) {
+                    var color = new WebInspector.Color(WebInspector.Color.Format.Nickname, WebInspector.Color.Nicknames[nickname].concat(1));
+                    color.nickname = nickname;
+                    color.original = colorString;
+                    return color;
+                } else
+                    return null;
+            } else if (match[4]) { // hsl
+                var hsl = match[4].replace(/%/g, "").split(/\s*,\s*/);
+                return new WebInspector.Color(WebInspector.Color.Format.HSL, [
+                    parseInt(hsl[0]),
+                    parseInt(hsl[1]),
+                    parseInt(hsl[2]),
                     1
                 ]);
             }
-        } else if (match[2]) { // rgb
-            var rgb = match[2].split(/\s*,\s*/);
-            return new WebInspector.Color(WebInspector.Color.Format.RGB, [
-                parseInt(rgb[0]),
-                parseInt(rgb[1]),
-                parseInt(rgb[2]),
-                1
-            ]);
-        } else if (match[3]) { // nickname
-            var nickname = match[3].toLowerCase();
-            if (WebInspector.Color.Nicknames.hasOwnProperty(nickname)) {
-                var color = new WebInspector.Color(WebInspector.Color.Format.Nickname, WebInspector.Color.Nicknames[nickname].concat(1));
-                color.nickname = nickname;
-                color.original = colorString;
-                return color;
-            } else
-                return null;
-        } else if (match[4]) { // hsl
-            var hsl = match[4].replace(/%/g, "").split(/\s*,\s*/);
-            return new WebInspector.Color(WebInspector.Color.Format.HSL, [
-                parseInt(hsl[0]),
-                parseInt(hsl[1]),
-                parseInt(hsl[2]),
-                1
-            ]);
         }
+
+        // Advanced - rgba(), hsla()
+        var advanced = /^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;
+        match = colorString.match(advanced);
+        if (match) {
+            if (match[1]) { // rgba
+                var rgba = match[1].split(/\s*,\s*/);
+                return new WebInspector.Color(WebInspector.Color.Format.RGBA, [
+                    parseInt(rgba[0]),
+                    parseInt(rgba[1]),
+                    parseInt(rgba[2]),
+                    Number.constrain(parseFloat(rgba[3]), 0, 1)
+                ]);
+            } else if (match[2]) { // hsla
+                var hsla = match[2].replace(/%/g, "").split(/\s*,\s*/);
+                return new WebInspector.Color(WebInspector.Color.Format.HSLA, [
+                    parseInt(hsla[0]),
+                    parseInt(hsla[1]),
+                    parseInt(hsla[2]),
+                    Number.constrain(parseFloat(hsla[3]), 0, 1)
+                ]);
+            }
+        }
+
+        return null;
+    }
+
+    static rgb2hsv(r, g, b)
+    {
+        r /= 255;
+        g /= 255;
+        b /= 255;
+
+        var min = Math.min(Math.min(r, g), b);
+        var max = Math.max(Math.max(r, g), b);
+        var delta = max - min;
+
+        var v = max;
+        var s, h;
+
+        if (max === min)
+            h = 0;
+        else if (max === r)
+            h = (60 * ((g - b) / delta)) % 360;
+        else if (max === g)
+            h = 60 * ((b - r) / delta) + 120;
+        else if (max === b)
+            h = 60 * ((r - g) / delta) + 240;
+
+        if (h < 0)
+            h += 360;
+
+        // Saturation
+        if (max === 0)
+            s = 0;
+        else
+            s = 1 - (min / max);
+
+        return [h, s, v];
     }
 
-    // Advanced - rgba(), hsla()
-    var advanced = /^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;
-    match = colorString.match(advanced);
-    if (match) {
-        if (match[1]) { // rgba
-            var rgba = match[1].split(/\s*,\s*/);
-            return new WebInspector.Color(WebInspector.Color.Format.RGBA, [
-                parseInt(rgba[0]),
-                parseInt(rgba[1]),
-                parseInt(rgba[2]),
-                Number.constrain(parseFloat(rgba[3]), 0, 1)
-            ]);
-        } else if (match[2]) { // hsla
-            var hsla = match[2].replace(/%/g, "").split(/\s*,\s*/);
-            return new WebInspector.Color(WebInspector.Color.Format.HSLA, [
-                parseInt(hsla[0]),
-                parseInt(hsla[1]),
-                parseInt(hsla[2]),
-                Number.constrain(parseFloat(hsla[3]), 0, 1)
-            ]);
+    static hsv2rgb(h, s, v)
+    {
+        if (s === 0)
+            return [v, v, v];
+
+        h /= 60;
+        var i = Math.floor(h);
+        var data = [
+            v * (1 - s),
+            v * (1 - s * (h - i)),
+            v * (1 - s * (1 - (h - i)))
+        ];
+        var rgb;
+
+        switch (i) {
+        case 0:
+            rgb = [v, data[2], data[0]];
+            break;
+        case 1:
+            rgb = [data[1], v, data[0]];
+            break;
+        case 2:
+            rgb = [data[0], v, data[2]];
+            break;
+        case 3:
+            rgb = [data[0], data[1], v];
+            break;
+        case 4:
+            rgb = [data[2], data[0], v];
+            break;
+        default:
+            rgb = [v, data[0], data[1]];
+            break;
         }
+
+        return rgb;
     }
 
-    return null;
-};
 
-WebInspector.Color.prototype = {
-    nextFormat: function(format)
+    // Public
+
+    nextFormat(format)
     {
         format = format || this.format;
 
@@ -175,47 +243,47 @@ WebInspector.Color.prototype = {
             console.error("Unknown color format.");
             return null;
         }
-    },
+    }
 
     get alpha()
     {
         return this._rgba ? this._rgba[3] : this._hsla[3];
-    },
+    }
 
     get simple()
     {
         return this.alpha === 1;
-    },
+    }
 
     get rgb()
     {
         var rgb = this.rgba.slice();
         rgb.pop();
         return rgb;
-    },
+    }
 
     get hsl()
     {
         var hsl = this.hsla.slice();
         hsl.pop();
         return hsl;
-    },
+    }
 
     get rgba()
     {
         if (!this._rgba)
             this._rgba = this._hslaToRGBA(this._hsla);
         return this._rgba;
-    },
+    }
 
     get hsla()
     {
         if (!this._hsla)
             this._hsla = this._rgbaToHSLA(this.rgba);
         return this._hsla;
-    },
+    }
 
-    copy: function()
+    copy()
     {
         switch (this.format) {
         case WebInspector.Color.Format.RGB:
@@ -228,9 +296,9 @@ WebInspector.Color.prototype = {
         case WebInspector.Color.Format.HSLA:
             return new WebInspector.Color(this.format, this.hsla);
         }
-    },
+    }
 
-    toString: function(format)
+    toString(format)
     {
         if (!format)
             format = this.format;
@@ -255,14 +323,16 @@ WebInspector.Color.prototype = {
         }
 
         throw "invalid color format";
-    },
+    }
 
-    _toOriginalString: function()
+    // Private
+
+    _toOriginalString()
     {
         return this.original || this._toNicknameString();
-    },
+    }
 
-    _toNicknameString: function()
+    _toNicknameString()
     {
         if (this.nickname)
             return this.nickname;
@@ -285,9 +355,9 @@ WebInspector.Color.prototype = {
         }
 
         return this._toRGBString();
-    },
+    }
 
-    _toShortHEXString: function()
+    _toShortHEXString()
     {
         if (!this.simple)
             return this._toRGBAString();
@@ -301,9 +371,9 @@ WebInspector.Color.prototype = {
             return "#" + r[0] + g[0] + b[0];
         else
             return "#" + r + g + b;
-    },
+    }
 
-    _toHEXString: function()
+    _toHEXString()
     {
         if (!this.simple)
             return this._toRGBAString();
@@ -314,38 +384,38 @@ WebInspector.Color.prototype = {
         var b = this._componentToHexValue(rgba[2]);
 
         return "#" + r + g + b;
-    },
+    }
 
-    _toRGBString: function()
+    _toRGBString()
     {
         if (!this.simple)
             return this._toRGBAString();
 
         var rgba = this.rgba;
         return "rgb(" + [rgba[0], rgba[1], rgba[2]].join(", ") + ")";
-    },
+    }
 
-    _toRGBAString: function()
+    _toRGBAString()
     {
         return "rgba(" + this.rgba.join(", ") + ")";
-    },
+    }
 
-    _toHSLString: function()
+    _toHSLString()
     {
         if (!this.simple)
             return this._toHSLAString();
 
         var hsla = this.hsla;
         return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)";
-    },
+    }
 
-    _toHSLAString: function()
+    _toHSLAString()
     {
         var hsla = this.hsla;
         return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
-    },
+    }
 
-    _canBeSerializedAsShortHEX: function()
+    _canBeSerializedAsShortHEX()
     {
         var rgba = this.rgba;
 
@@ -362,22 +432,22 @@ WebInspector.Color.prototype = {
             return false;
 
         return true;
-    },
+    }
 
-    _componentToNumber: function(value)
+    _componentToNumber(value)
     {
         return Number.constrain(value, 0, 255);
-    },
+    }
 
-    _componentToHexValue: function(value)
+    _componentToHexValue(value)
     {
         var hex = this._componentToNumber(value).toString(16);
         if (hex.length === 1)
             hex = "0" + hex;
         return hex;
-    },
+    }
 
-    _rgbToHSL: function(rgb)
+    _rgbToHSL(rgb)
     {
         var r = this._componentToNumber(rgb[0]) / 255;
         var g = this._componentToNumber(rgb[1]) / 255;
@@ -412,9 +482,9 @@ WebInspector.Color.prototype = {
         l = Math.round(l * 100);
 
         return [h, s, l];
-    },
+    }
 
-    _hslToRGB: function(hsl)
+    _hslToRGB(hsl)
     {
         var h = parseFloat(hsl[0]) / 360;
         var s = parseFloat(hsl[1]) / 100;
@@ -434,16 +504,16 @@ WebInspector.Color.prototype = {
             Math.round(sArray[ (h | 16) % 6 ] * 255),
             Math.round(sArray[ (h | 8)  % 6 ] * 255)
         ];
-    },
+    }
 
-    _rgbaToHSLA: function(rgba)
+    _rgbaToHSLA(rgba)
     {
         var hsl = this._rgbToHSL(rgba);
         hsl.push(rgba[3]);
         return hsl;
-    },
+    }
 
-    _hslaToRGBA: function(hsla)
+    _hslaToRGBA(hsla)
     {
         var rgba = this._hslToRGB(hsla);
         rgba.push(hsla[3]);
@@ -451,6 +521,17 @@ WebInspector.Color.prototype = {
     }
 };
 
+WebInspector.Color.Format = {
+    Original: "color-format-original",
+    Nickname: "color-format-nickname",
+    HEX: "color-format-hex",
+    ShortHEX: "color-format-short-hex",
+    RGB: "color-format-rgb",
+    RGBA: "color-format-rgba",
+    HSL: "color-format-hsl",
+    HSLA: "color-format-hsla"
+};
+
 WebInspector.Color.Nicknames = {
     "aliceblue": [240, 248, 255],
     "antiquewhite": [250, 235, 215],
@@ -592,75 +673,3 @@ WebInspector.Color.Nicknames = {
     "yellow": [255, 255, 0],
     "yellowgreen": [154, 205, 50]
 };
-
-WebInspector.Color.rgb2hsv = function(r, g, b)
-{
-    r /= 255;
-    g /= 255;
-    b /= 255;
-
-    var min = Math.min(Math.min(r, g), b);
-    var max = Math.max(Math.max(r, g), b);
-    var delta = max - min;
-
-    var v = max;
-    var s, h;
-
-    if (max === min)
-        h = 0;
-    else if (max === r)
-        h = (60 * ((g - b) / delta)) % 360;
-    else if (max === g)
-        h = 60 * ((b - r) / delta) + 120;
-    else if (max === b)
-        h = 60 * ((r - g) / delta) + 240;
-
-    if (h < 0)
-        h += 360;
-
-    // Saturation
-    if (max === 0)
-        s = 0;
-    else
-        s = 1 - (min / max);
-
-    return [h, s, v];
-};
-
-WebInspector.Color.hsv2rgb = function(h, s, v)
-{
-    if (s === 0)
-        return [v, v, v];
-
-    h /= 60;
-    var i = Math.floor(h);
-    var data = [
-        v * (1 - s),
-        v * (1 - s * (h - i)),
-        v * (1 - s * (1 - (h - i)))
-    ];
-    var rgb;
-
-    switch (i) {
-    case 0:
-        rgb = [v, data[2], data[0]];
-        break;
-    case 1:
-        rgb = [data[1], v, data[0]];
-        break;
-    case 2:
-        rgb = [data[0], v, data[2]];
-        break;
-    case 3:
-        rgb = [data[0], data[1], v];
-        break;
-    case 4:
-        rgb = [data[2], data[0], v];
-        break;
-    default:
-        rgb = [v, data[0], data[1]];
-        break;
-    }
-
-    return rgb;
-};
index 726316a..cc063d3 100644 (file)
  * SUCH DAMAGE.
  */
 
-WebInspector.ContentFlow = function(documentNodeIdentifier, name, overset, contentNodes)
+WebInspector.ContentFlow = class ContentFlow extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._documentNodeIdentifier = documentNodeIdentifier;
-    this._name = name;
-    this._overset = overset;
-    this._contentNodes = contentNodes;
-};
-
-WebInspector.ContentFlow.Event = {
-    OversetWasChanged: "content-flow-overset-was-changed",
-    ContentNodeWasAdded: "content-flow-content-node-was-added",
-    ContentNodeWasRemoved: "content-flow-content-node-was-removed"
-};
-
-WebInspector.ContentFlow.prototype = {
+    constructor(documentNodeIdentifier, name, overset, contentNodes)
+    {
+        super();
 
-    constructor: WebInspector.ContentFlow,
-    __proto__: WebInspector.Object.prototype,
+        this._documentNodeIdentifier = documentNodeIdentifier;
+        this._name = name;
+        this._overset = overset;
+        this._contentNodes = contentNodes;
+    }
 
     // Public
 
@@ -54,22 +45,22 @@ WebInspector.ContentFlow.prototype = {
     {
         // Use the flow node id, to avoid collisions when we change main document id.
         return this._documentNodeIdentifier + ":" + this._name;
-    },
+    }
 
     get documentNodeIdentifier()
     {
         return this._documentNodeIdentifier;
-    },
+    }
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get overset()
     {
         return this._overset;
-    },
+    }
 
     set overset(overset)
     {
@@ -77,28 +68,28 @@ WebInspector.ContentFlow.prototype = {
             return;
         this._overset = overset;
         this.dispatchEventToListeners(WebInspector.ContentFlow.Event.FlowOversetWasChanged);
-    },
+    }
 
     get contentNodes()
     {
         return this._contentNodes;
-    },
+    }
 
-    insertContentNodeBefore: function(contentNode, referenceNode)
+    insertContentNodeBefore(contentNode, referenceNode)
     {
         var index = this._contentNodes.indexOf(referenceNode);
         console.assert(index !== -1);
         this._contentNodes.splice(index, 0, contentNode);
         this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasAdded, {node: contentNode, before: referenceNode});
-    },
+    }
 
-    appendContentNode: function(contentNode)
+    appendContentNode(contentNode)
     {
         this._contentNodes.push(contentNode);
         this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasAdded, {node: contentNode});
-    },
+    }
 
-    removeContentNode: function(contentNode)
+    removeContentNode(contentNode)
     {
         var index = this._contentNodes.indexOf(contentNode);
         console.assert(index !== -1);
@@ -106,3 +97,9 @@ WebInspector.ContentFlow.prototype = {
         this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, {node: contentNode});
     }
 };
+
+WebInspector.ContentFlow.Event = {
+    OversetWasChanged: "content-flow-overset-was-changed",
+    ContentNodeWasAdded: "content-flow-content-node-was-added",
+    ContentNodeWasRemoved: "content-flow-content-node-was-removed"
+};
index 0ae60f1..386b917 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CookieStorageObject = function(host)
+WebInspector.CookieStorageObject = class CookieStorageObject
 {
-    this._host = host;
-};
-
-WebInspector.CookieStorageObject.TypeIdentifier = "cookie-storage";
-WebInspector.CookieStorageObject.CookieHostCookieKey = "cookie-storage-host";
+    constructor(host)
+    {
+        this._host = host;
+    }
 
-WebInspector.CookieStorageObject.prototype = {
-    constructor: WebInspector.CookieStorageObject,
+    // Public
 
     get host()
     {
         return this._host;
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
+        // FIXME: This class will need to look up cookies that are set for this host.
         cookie[WebInspector.CookieStorageObject.CookieHostCookieKey] = this.host;
-    }
-    // FIXME: This class will need to look up cookies that are set for this host.
+    }    
 };
+
+WebInspector.CookieStorageObject.TypeIdentifier = "cookie-storage";
+WebInspector.CookieStorageObject.CookieHostCookieKey = "cookie-storage-host";
index 25a3ef6..3057f9a 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMNode = function(domAgent, doc, isInShadowTree, payload) {
-    WebInspector.Object.call(this);
-
-    this._domAgent = domAgent;
-    this._isInShadowTree = isInShadowTree;
-
-    this.id = payload.nodeId;
-    domAgent._idToDOMNode[this.id] = this;
-
-    this._nodeType = payload.nodeType;
-    this._nodeName = payload.nodeName;
-    this._localName = payload.localName;
-    this._nodeValue = payload.nodeValue;
-    this._computedRole = payload.role;
-
-    if (this._nodeType === Node.DOCUMENT_NODE)
-        this.ownerDocument = this;
-    else
-        this.ownerDocument = doc;
-
-    this._attributes = [];
-    this._attributesMap = {};
-    if (payload.attributes)
-        this._setAttributesPayload(payload.attributes);
-
-    this._childNodeCount = payload.childNodeCount;
-    this._children = null;
-    this._filteredChildren = null;
-    this._filteredChildrenNeedsUpdating = true;
-
-    this._nextSibling = null;
-    this._previousSibling = null;
-    this.parentNode = null;
-
-    this._enabledPseudoClasses = [];
-
-    this._shadowRoots = [];
-    if (payload.shadowRoots) {
-        for (var i = 0; i < payload.shadowRoots.length; ++i) {
-            var root = payload.shadowRoots[i];
-            var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, true, root);
-            this._shadowRoots.push(node);
+WebInspector.DOMNode = class DOMNode extends WebInspector.Object
+{
+    constructor(domAgent, doc, isInShadowTree, payload)
+    {
+        super();
+
+        this._domAgent = domAgent;
+        this._isInShadowTree = isInShadowTree;
+
+        this.id = payload.nodeId;
+        domAgent._idToDOMNode[this.id] = this;
+
+        this._nodeType = payload.nodeType;
+        this._nodeName = payload.nodeName;
+        this._localName = payload.localName;
+        this._nodeValue = payload.nodeValue;
+        this._computedRole = payload.role;
+
+        if (this._nodeType === Node.DOCUMENT_NODE)
+            this.ownerDocument = this;
+        else
+            this.ownerDocument = doc;
+
+        this._attributes = [];
+        this._attributesMap = {};
+        if (payload.attributes)
+            this._setAttributesPayload(payload.attributes);
+
+        this._childNodeCount = payload.childNodeCount;
+        this._children = null;
+        this._filteredChildren = null;
+        this._filteredChildrenNeedsUpdating = true;
+
+        this._nextSibling = null;
+        this._previousSibling = null;
+        this.parentNode = null;
+
+        this._enabledPseudoClasses = [];
+
+        this._shadowRoots = [];
+        if (payload.shadowRoots) {
+            for (var i = 0; i < payload.shadowRoots.length; ++i) {
+                var root = payload.shadowRoots[i];
+                var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, true, root);
+                this._shadowRoots.push(node);
+            }
         }
-    }
 
-    if (payload.children)
-        this._setChildrenPayload(payload.children);
+        if (payload.children)
+            this._setChildrenPayload(payload.children);
 
-    if (payload.contentDocument) {
-        this._contentDocument = new WebInspector.DOMNode(domAgent, null, false, payload.contentDocument);
-        this._children = [this._contentDocument];
-        this._renumber();
-    }
+        if (payload.contentDocument) {
+            this._contentDocument = new WebInspector.DOMNode(domAgent, null, false, payload.contentDocument);
+            this._children = [this._contentDocument];
+            this._renumber();
+        }
 
-    if (this._nodeType === Node.ELEMENT_NODE) {
-        // HTML and BODY from internal iframes should not overwrite top-level ones.
-        if (this.ownerDocument && !this.ownerDocument.documentElement && this._nodeName === "HTML")
-            this.ownerDocument.documentElement = this;
-        if (this.ownerDocument && !this.ownerDocument.body && this._nodeName === "BODY")
-            this.ownerDocument.body = this;
-        if (payload.documentURL)
+        if (this._nodeType === Node.ELEMENT_NODE) {
+            // HTML and BODY from internal iframes should not overwrite top-level ones.
+            if (this.ownerDocument && !this.ownerDocument.documentElement && this._nodeName === "HTML")
+                this.ownerDocument.documentElement = this;
+            if (this.ownerDocument && !this.ownerDocument.body && this._nodeName === "BODY")
+                this.ownerDocument.body = this;
+            if (payload.documentURL)
+                this.documentURL = payload.documentURL;
+        } else if (this._nodeType === Node.DOCUMENT_TYPE_NODE) {
+            this.publicId = payload.publicId;
+            this.systemId = payload.systemId;
+            this.internalSubset = payload.internalSubset;
+        } else if (this._nodeType === Node.DOCUMENT_NODE) {
             this.documentURL = payload.documentURL;
-    } else if (this._nodeType === Node.DOCUMENT_TYPE_NODE) {
-        this.publicId = payload.publicId;
-        this.systemId = payload.systemId;
-        this.internalSubset = payload.internalSubset;
-    } else if (this._nodeType === Node.DOCUMENT_NODE) {
-        this.documentURL = payload.documentURL;
-        this.xmlVersion = payload.xmlVersion;
-    } else if (this._nodeType === Node.ATTRIBUTE_NODE) {
-        this.name = payload.name;
-        this.value = payload.value;
+            this.xmlVersion = payload.xmlVersion;
+        } else if (this._nodeType === Node.ATTRIBUTE_NODE) {
+            this.name = payload.name;
+            this.value = payload.value;
+        }
     }
-};
 
-WebInspector.Object.addConstructorFunctions(WebInspector.DOMNode);
-
-WebInspector.DOMNode.Event = {
-    EnabledPseudoClassesChanged: "dom-node-enabled-pseudo-classes-did-change",
-    AttributeModified: "dom-node-attribute-modified",
-    AttributeRemoved: "dom-node-attribute-removed"
-};
-
-WebInspector.DOMNode.prototype = {
-    constructor: WebInspector.DOMNode,
+    // Public
 
     get children()
     {
@@ -132,7 +126,7 @@ WebInspector.DOMNode.prototype = {
         }
 
         return this._filteredChildren;
-    },
+    }
 
     get firstChild()
     {
@@ -142,7 +136,7 @@ WebInspector.DOMNode.prototype = {
             return children[0];
 
         return null;
-    },
+    }
 
     get lastChild()
     {
@@ -152,7 +146,7 @@ WebInspector.DOMNode.prototype = {
             return children.lastValue;
 
         return null;
-    },
+    }
 
     get nextSibling()
     {
@@ -166,7 +160,7 @@ WebInspector.DOMNode.prototype = {
             node = node._nextSibling;
         }
         return null;
-    },
+    }
 
     get previousSibling()
     {
@@ -180,7 +174,7 @@ WebInspector.DOMNode.prototype = {
             node = node._previousSibling;
         }
         return null;
-    },
+    }
 
     get childNodeCount()
     {
@@ -192,95 +186,95 @@ WebInspector.DOMNode.prototype = {
             return this._childNodeCount + this._shadowRoots.length;
 
         return this._childNodeCount;
-    },
+    }
 
     set childNodeCount(count)
     {
         this._childNodeCount = count;
-    },
+    }
 
-    computedRole: function()
+    computedRole()
     {
         return this._computedRole;
-    },
+    }
 
-    hasAttributes: function()
+    hasAttributes()
     {
         return this._attributes.length > 0;
-    },
+    }
 
-    hasChildNodes: function()
+    hasChildNodes()
     {
         return this.childNodeCount > 0;
-    },
+    }
 
-    hasShadowRoots: function()
+    hasShadowRoots()
     {
         return !!this._shadowRoots.length;
-    },
+    }
 
-    isInShadowTree: function()
+    isInShadowTree()
     {
         return this._isInShadowTree;
-    },
+    }
 
-    nodeType: function()
+    nodeType()
     {
         return this._nodeType;
-    },
+    }
 
-    nodeName: function()
+    nodeName()
     {
         return this._nodeName;
-    },
+    }
 
-    nodeNameInCorrectCase: function()
+    nodeNameInCorrectCase()
     {
         return this.isXMLNode() ? this.nodeName() : this.nodeName().toLowerCase();
-    },
+    }
 
-    setNodeName: function(name, callback)
+    setNodeName(name, callback)
     {
         DOMAgent.setNodeName(this.id, name, this._makeUndoableCallback(callback));
-    },
+    }
 
-    localName: function()
+    localName()
     {
         return this._localName;
-    },
+    }
 
-    nodeValue: function()
+    nodeValue()
     {
         return this._nodeValue;
-    },
+    }
 
-    setNodeValue: function(value, callback)
+    setNodeValue(value, callback)
     {
         DOMAgent.setNodeValue(this.id, value, this._makeUndoableCallback(callback));
-    },
+    }
 
-    getAttribute: function(name)
+    getAttribute(name)
     {
         var attr = this._attributesMap[name];
         return attr ? attr.value : undefined;
-    },
+    }
 
-    setAttribute: function(name, text, callback)
+    setAttribute(name, text, callback)
     {
         DOMAgent.setAttributesAsText(this.id, text, name, this._makeUndoableCallback(callback));
-    },
+    }
 
-    setAttributeValue: function(name, value, callback)
+    setAttributeValue(name, value, callback)
     {
         DOMAgent.setAttributeValue(this.id, name, value, this._makeUndoableCallback(callback));
-    },
+    }
 
-    attributes: function()
+    attributes()
     {
         return this._attributes;
-    },
+    }
 
-    removeAttribute: function(name, callback)
+    removeAttribute(name, callback)
     {
         function mycallback(error, success)
         {
@@ -297,9 +291,9 @@ WebInspector.DOMNode.prototype = {
             this._makeUndoableCallback(callback)(error);
         }
         DOMAgent.removeAttribute(this.id, name, mycallback.bind(this));
-    },
+    }
 
-    getChildNodes: function(callback)
+    getChildNodes(callback)
     {
         if (this.children) {
             if (callback)
@@ -313,9 +307,9 @@ WebInspector.DOMNode.prototype = {
         }
 
         DOMAgent.requestChildNodes(this.id, mycallback.bind(this));
-    },
+    }
 
-    getSubtree: function(depth, callback)
+    getSubtree(depth, callback)
     {
         function mycallback(error)
         {
@@ -324,24 +318,24 @@ WebInspector.DOMNode.prototype = {
         }
 
         DOMAgent.requestChildNodes(this.id, depth, mycallback.bind(this));
-    },
+    }
 
-    getOuterHTML: function(callback)
+    getOuterHTML(callback)
     {
         DOMAgent.getOuterHTML(this.id, callback);
-    },
+    }
 
-    setOuterHTML: function(html, callback)
+    setOuterHTML(html, callback)
     {
         DOMAgent.setOuterHTML(this.id, html, this._makeUndoableCallback(callback));
-    },
+    }
 
-    removeNode: function(callback)
+    removeNode(callback)
     {
         DOMAgent.removeNode(this.id, this._makeUndoableCallback(callback));
-    },
+    }
 
-    copyNode: function()
+    copyNode()
     {
         function copy(error, text)
         {
@@ -349,14 +343,14 @@ WebInspector.DOMNode.prototype = {
                 InspectorFrontendHost.copyText(text);
         }
         DOMAgent.getOuterHTML(this.id, copy);
-    },
+    }
 
-    eventListeners: function(callback)
+    eventListeners(callback)
     {
         DOMAgent.getEventListenersForNode(this.id, callback);
-    },
+    }
 
-    accessibilityProperties: function(callback)
+    accessibilityProperties(callback)
     {
         function accessibilityPropertiesCallback(error, accessibilityProperties)
         {
@@ -394,9 +388,9 @@ WebInspector.DOMNode.prototype = {
             }
         }
         DOMAgent.getAccessibilityPropertiesForNode(this.id, accessibilityPropertiesCallback.bind(this));
-    },
+    }
 
-    path: function()
+    path()
     {
         var path = [];
         var node = this;
@@ -406,9 +400,9 @@ WebInspector.DOMNode.prototype = {
         }
         path.reverse();
         return path.join(",");
-    },
+    }
 
-    appropriateSelectorFor: function(justSelector)
+    appropriateSelectorFor(justSelector)
     {
         var lowerCaseName = this.localName() || this.nodeName().toLowerCase();
 
@@ -432,9 +426,9 @@ WebInspector.DOMNode.prototype = {
             return lowerCaseName + "[type=\"" + this.getAttribute("type") + "\"]";
 
         return lowerCaseName;
-    },
+    }
 
-    isAncestor: function(node)
+    isAncestor(node)
     {
         if (!node)
             return false;
@@ -446,22 +440,22 @@ WebInspector.DOMNode.prototype = {
             currentNode = currentNode.parentNode;
         }
         return false;
-    },
+    }
 
-    isDescendant: function(descendant)
+    isDescendant(descendant)
     {
         return descendant !== null && descendant.isAncestor(this);
-    },
+    }
 
-    _setAttributesPayload: function(attrs)
+    _setAttributesPayload(attrs)
     {
         this._attributes = [];
         this._attributesMap = {};
         for (var i = 0; i < attrs.length; i += 2)
             this._addAttribute(attrs[i], attrs[i + 1]);
-    },
+    }
 
-    _insertChild: function(prev, payload)
+    _insertChild(prev, payload)
     {
         var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, this._isInShadowTree, payload);
         if (!prev) {
@@ -474,16 +468,16 @@ WebInspector.DOMNode.prototype = {
             this._children.splice(this._children.indexOf(prev) + 1, 0, node);
         this._renumber();
         return node;
-    },
+    }
 
-    _removeChild: function(node)
+    _removeChild(node)
     {
         this._children.splice(this._children.indexOf(node), 1);
         node.parentNode = null;
         this._renumber();
-    },
+    }
 
-    _setChildrenPayload: function(payloads)
+    _setChildrenPayload(payloads)
     {
         // We set children in the constructor.
         if (this._contentDocument)
@@ -496,9 +490,9 @@ WebInspector.DOMNode.prototype = {
             this._children.push(node);
         }
         this._renumber();
-    },
+    }
 
-    _renumber: function()
+    _renumber()
     {
         this._filteredChildrenNeedsUpdating = true;
 
@@ -513,49 +507,49 @@ WebInspector.DOMNode.prototype = {
             child._previousSibling = i - 1 >= 0 ? this._children[i - 1] : null;
             child.parentNode = this;
         }
-    },
+    }
 
-    _addAttribute: function(name, value)
+    _addAttribute(name, value)
     {
         var attr = {name, value, _node: this};
         this._attributesMap[name] = attr;
         this._attributes.push(attr);
-    },
+    }
 
-    _setAttribute: function(name, value)
+    _setAttribute(name, value)
     {
         var attr = this._attributesMap[name];
         if (attr)
             attr.value = value;
         else
             this._addAttribute(name, value);
-    },
+    }
 
-    _removeAttribute: function(name)
+    _removeAttribute(name)
     {
         var attr = this._attributesMap[name];
         if (attr) {
             this._attributes.remove(attr);
             delete this._attributesMap[name];
         }
-    },
+    }
 
-    moveTo: function(targetNode, anchorNode, callback)
+    moveTo(targetNode, anchorNode, callback)
     {
         DOMAgent.moveTo(this.id, targetNode.id, anchorNode ? anchorNode.id : undefined, this._makeUndoableCallback(callback));
-    },
+    }
 
-    isXMLNode: function()
+    isXMLNode()
     {
         return !!this.ownerDocument && !!this.ownerDocument.xmlVersion;
-    },
+    }
 
     get enabledPseudoClasses()
     {
         return this._enabledPseudoClasses;
-    },
+    }
 
-    setPseudoClassEnabled: function(pseudoClass, enabled)
+    setPseudoClassEnabled(pseudoClass, enabled)
     {
         var pseudoClasses = this._enabledPseudoClasses;
         if (enabled) {
@@ -575,9 +569,9 @@ WebInspector.DOMNode.prototype = {
         }
 
         CSSAgent.forcePseudoState(this.id, pseudoClasses, changed.bind(this));
-    },
+    }
 
-    _makeUndoableCallback: function(callback)
+    _makeUndoableCallback(callback)
     {
         return function(error)
         {
@@ -590,4 +584,8 @@ WebInspector.DOMNode.prototype = {
     }
 };
 
-WebInspector.DOMNode.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.DOMNode.Event = {
+    EnabledPseudoClassesChanged: "dom-node-enabled-pseudo-classes-did-change",
+    AttributeModified: "dom-node-attribute-modified",
+    AttributeRemoved: "dom-node-attribute-removed"
+};
index 7252671..86dec58 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMNodeStyles = function(node)
+WebInspector.DOMNodeStyles = class DOMNodeStyles extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    console.assert(node);
-    this._node = node || null;
-
-    this._rulesMap = {};
-    this._styleDeclarationsMap = {};
-
-    this._matchedRules = [];
-    this._inheritedRules = [];
-    this._pseudoElements = {};
-    this._inlineStyle = null;
-    this._attributesStyle = null;
-    this._computedStyle = null;
-    this._orderedStyles = [];
-    this._stylesNeedingTextCommited = [];
+    constructor(node)
+    {
+        super();
 
-    this._propertyNameToEffectivePropertyMap = {};
+        console.assert(node);
+        this._node = node || null;
 
-    this.refresh();
-};
+        this._rulesMap = {};
+        this._styleDeclarationsMap = {};
 
-WebInspector.Object.addConstructorFunctions(WebInspector.DOMNodeStyles);
+        this._matchedRules = [];
+        this._inheritedRules = [];
+        this._pseudoElements = {};
+        this._inlineStyle = null;
+        this._attributesStyle = null;
+        this._computedStyle = null;
+        this._orderedStyles = [];
+        this._stylesNeedingTextCommited = [];
 
-WebInspector.DOMNodeStyles.Event = {
-    NeedsRefresh: "dom-node-styles-needs-refresh",
-    Refreshed: "dom-node-styles-refreshed"
-};
+        this._propertyNameToEffectivePropertyMap = {};
 
-WebInspector.DOMNodeStyles.prototype = {
-    constructor: WebInspector.DOMNodeStyles,
+        this.refresh();
+    }
 
     // Public
 
     get node()
     {
         return this._node;
-    },
+    }
 
     get needsRefresh()
     {
         return this._refreshPending || this._needsRefresh;
-    },
+    }
 
-    refreshIfNeeded: function()
+    refreshIfNeeded()
     {
         if (!this._needsRefresh)
             return;
         this.refresh();
-    },
+    }
 
-    refresh: function()
+    refresh()
     {
         if (this._refreshPending)
             return;
@@ -246,9 +238,9 @@ WebInspector.DOMNodeStyles.prototype = {
         CSSAgent.getMatchedStylesForNode.invoke({nodeId: this._node.id, includePseudo: true, includeInherited: true}, fetchedMatchedStyles.bind(this));
         CSSAgent.getInlineStylesForNode.invoke({nodeId: this._node.id}, fetchedInlineStyles.bind(this));
         CSSAgent.getComputedStyleForNode.invoke({nodeId: this._node.id}, fetchedComputedStyle.bind(this));
-    },
+    }
 
-    addEmptyRule: function()
+    addEmptyRule()
     {
         function addedRule(error, rulePayload)
         {
@@ -263,63 +255,63 @@ WebInspector.DOMNodeStyles.prototype = {
         selector = this._node.appropriateSelectorFor(true);
 
         CSSAgent.addRule.invoke({contextNodeId: this._node.id, selector}, addedRule.bind(this));
-    },
+    }
 
     get matchedRules()
     {
         return this._matchedRules;
-    },
+    }
 
     get inheritedRules()
     {
         return this._inheritedRules;
-    },
+    }
 
     get inlineStyle()
     {
         return this._inlineStyle;
-    },
+    }
 
     get attributesStyle()
     {
         return this._attributesStyle;
-    },
+    }
 
     get pseudoElements()
     {
         return this._pseudoElements;
-    },
+    }
 
     get computedStyle()
     {
         return this._computedStyle;
-    },
+    }
 
     get orderedStyles()
     {
         return this._orderedStyles;
-    },
+    }
 
-    effectivePropertyForName: function(name)
+    effectivePropertyForName(name)
     {
         var canonicalName = WebInspector.cssStyleManager.canonicalNameForPropertyName(name);
         return this._propertyNameToEffectivePropertyMap[canonicalName] || null;
-    },
+    }
 
     // Protected
 
-    mediaQueryResultDidChange: function()
+    mediaQueryResultDidChange()
     {
         this._markAsNeedsRefresh();
-    },
+    }
 
-    pseudoClassesDidChange: function(node)
+    pseudoClassesDidChange(node)
     {
         this._includeUserAgentRulesOnNextRefresh = true;
         this._markAsNeedsRefresh();
-    },
+    }
 
-    attributeDidChange: function(node, attributeName)
+    attributeDidChange(node, attributeName)
     {
         // Ignore the attribute we know we just changed and handled above.
         if (this._ignoreNextStyleAttributeDidChangeEvent && node === this._node && attributeName === "style") {
@@ -328,9 +320,9 @@ WebInspector.DOMNodeStyles.prototype = {
         }
 
         this._markAsNeedsRefresh();
-    },
+    }
 
-    changeRuleSelector: function(rule, selector)
+    changeRuleSelector(rule, selector)
     {
         selector = selector || "";
 
@@ -347,41 +339,41 @@ WebInspector.DOMNodeStyles.prototype = {
         this._ignoreNextContentDidChangeForStyleSheet = rule.ownerStyleSheet;
 
         CSSAgent.setRuleSelector(rule.id, selector, ruleSelectorChanged.bind(this));
-    },
+    }
 
-    changeStyleText: function(style, text)
+    changeStyleText(style, text)
     {
         if (!style.ownerStyleSheet || !style.styleSheetTextRange)
             return;
 
         text = text || "";
 
-        if (CSSAgent.setStyleText) {
-            function styleChanged(error, stylePayload)
-            {
-                if (error)
-                    return;
-                this.refresh();
-            }
+        function styleChanged(error, stylePayload)
+        {
+            if (error)
+                return;
+            this.refresh();
+        }
 
+        if (CSSAgent.setStyleText) {
             CSSAgent.setStyleText(style.id, text, styleChanged.bind(this));
             return;
         }
 
         // COMPATIBILITY (iOS 6): CSSAgent.setStyleText was not available in iOS 6.
 
+        function attributeChanged(error)
+        {
+            if (error)
+                return;
+            this.refresh();
+        }
+
         // Setting the text on CSSStyleSheet for inline styles causes a crash. https://webkit.org/b/110359
         // So we just set the style attribute to get the same affect. This also avoids SourceCodeRevisions.
         if (style.type === WebInspector.CSSStyleDeclaration.Type.Inline) {
             text = text.trim();
 
-            function attributeChanged(error)
-            {
-                if (error)
-                    return;
-                this.refresh();
-            }
-
             this._ignoreNextStyleAttributeDidChangeEvent = true;
 
             if (text)
@@ -449,11 +441,11 @@ WebInspector.DOMNodeStyles.prototype = {
         this._ignoreNextContentDidChangeForStyleSheet = style.ownerStyleSheet;
 
         style.ownerStyleSheet.requestContent().then(fetchedStyleSheetContent.bind(this));
-    },
+    }
 
     // Private
 
-    _createSourceCodeLocation: function(sourceURL, sourceLine, sourceColumn)
+    _createSourceCodeLocation(sourceURL, sourceLine, sourceColumn)
     {
         if (!sourceURL)
             return null;
@@ -477,9 +469,9 @@ WebInspector.DOMNodeStyles.prototype = {
             return null;
 
         return sourceCode.createSourceCodeLocation(sourceLine || 0, sourceColumn || 0);
-    },
+    }
 
-    _parseSourceRangePayload: function(payload, text)
+    _parseSourceRangePayload(payload, text)
     {
         if (!payload)
             return null;
@@ -494,9 +486,9 @@ WebInspector.DOMNodeStyles.prototype = {
         }
 
         return new WebInspector.TextRange(payload.startLine, payload.startColumn, payload.endLine, payload.endColumn);
-    },
+    }
 
-    _parseStylePropertyPayload: function(payload, index, styleDeclaration, styleText)
+    _parseStylePropertyPayload(payload, index, styleDeclaration, styleText)
     {
         var text = payload.text || "";
         var name = payload.name;
@@ -564,9 +556,9 @@ WebInspector.DOMNodeStyles.prototype = {
         }
 
         return new WebInspector.CSSProperty(index, text, name, value, priority, enabled, overridden, implicit, anonymous, valid, styleSheetTextRange, styleDeclarationTextRange);
-    },
+    }
 
-    _parseStyleDeclarationPayload: function(payload, node, inherited, type, rule, updateAllStyles)
+    _parseStyleDeclarationPayload(payload, node, inherited, type, rule, updateAllStyles)
     {
         if (!payload)
             return null;
@@ -674,9 +666,9 @@ WebInspector.DOMNodeStyles.prototype = {
         }
 
         return styleDeclaration;
-    },
+    }
 
-    _parseSelectorListPayload: function(selectorList)
+    _parseSelectorListPayload(selectorList)
     {
         // COMPATIBILITY (iOS 6): The payload did not have 'selectorList'.
         if (!selectorList)
@@ -697,9 +689,9 @@ WebInspector.DOMNodeStyles.prototype = {
         return selectors.map(function(selectorPayload) {
             return new WebInspector.CSSSelector(selectorPayload.text, selectorPayload.specificity, selectorPayload.dynamic);
         });
-    },
+    }
 
-    _parseRulePayload: function(payload, matchedSelectorIndices, node, inherited, ruleOccurrences)
+    _parseRulePayload(payload, matchedSelectorIndices, node, inherited, ruleOccurrences)
     {
         if (!payload)
             return null;
@@ -812,15 +804,15 @@ WebInspector.DOMNodeStyles.prototype = {
             this._rulesMap[mapKey] = rule;
 
         return rule;
-    },
+    }
 
-    _markAsNeedsRefresh: function()
+    _markAsNeedsRefresh()
     {
         this._needsRefresh = true;
         this.dispatchEventToListeners(WebInspector.DOMNodeStyles.Event.NeedsRefresh);
-    },
+    }
 
-    _styleSheetContentDidChange: function(event)
+    _styleSheetContentDidChange(event)
     {
         var styleSheet = event.target;
         console.assert(styleSheet);
@@ -834,9 +826,9 @@ WebInspector.DOMNodeStyles.prototype = {
         }
 
         this._markAsNeedsRefresh();
-    },
+    }
 
-    _updateStyleCascade: function()
+    _updateStyleCascade()
     {
         var cascadeOrderedStyleDeclarations = this._collectStylesInCascadeOrder(this._matchedRules, this._inlineStyle, this._attributesStyle);
 
@@ -859,9 +851,9 @@ WebInspector.DOMNodeStyles.prototype = {
             this._markOverriddenProperties(pseudoElementInfo.orderedStyles);
             this._associateRelatedProperties(pseudoElementInfo.orderedStyles);
         }
-    },
+    }
 
-    _collectStylesInCascadeOrder: function(matchedRules, inlineStyle, attributesStyle)
+    _collectStylesInCascadeOrder(matchedRules, inlineStyle, attributesStyle)
     {
         var result = [];
 
@@ -897,9 +889,9 @@ WebInspector.DOMNodeStyles.prototype = {
         result = result.concat(userAndUserAgentStyles);
 
         return result;
-    },
+    }
 
-    _markOverriddenProperties: function(styles, propertyNameToEffectiveProperty)
+    _markOverriddenProperties(styles, propertyNameToEffectiveProperty)
     {
         propertyNameToEffectiveProperty = propertyNameToEffectiveProperty || {};
 
@@ -941,9 +933,9 @@ WebInspector.DOMNodeStyles.prototype = {
                 propertyNameToEffectiveProperty[canonicalName] = property;
             }
         }
-    },
+    }
 
-    _associateRelatedProperties: function(styles, propertyNameToEffectiveProperty)
+    _associateRelatedProperties(styles, propertyNameToEffectiveProperty)
     {
         for (var i = 0; i < styles.length; ++i) {
             var properties = styles[i].properties;
@@ -1001,4 +993,7 @@ WebInspector.DOMNodeStyles.prototype = {
     }
 };
 
-WebInspector.DOMNodeStyles.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.DOMNodeStyles.Event = {
+    NeedsRefresh: "dom-node-styles-needs-refresh",
+    Refreshed: "dom-node-styles-refreshed"
+};
index e147025..96e2bdc 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMSearchMatchObject = function(resource, domNode, title, searchTerm, textRange)
+WebInspector.DOMSearchMatchObject = class DOMSearchMatchObject extends WebInspector.Object
 {
-    console.assert(resource instanceof WebInspector.Resource);
-    console.assert(domNode instanceof WebInspector.DOMNode);
+    constructor(resource, domNode, title, searchTerm, textRange)
+    {
+        super();
 
-    WebInspector.Object.call(this);
+        console.assert(resource instanceof WebInspector.Resource);
+        console.assert(domNode instanceof WebInspector.DOMNode);
 
-    this._resource = resource;
-    this._domNode = domNode;
-    this._title = title;
-    this._searchTerm = searchTerm;
-    this._sourceCodeTextRange = resource.createSourceCodeTextRange(textRange);
-};
+        this._resource = resource;
+        this._domNode = domNode;
+        this._title = title;
+        this._searchTerm = searchTerm;
+        this._sourceCodeTextRange = resource.createSourceCodeTextRange(textRange);
+    }
 
-WebInspector.DOMSearchMatchObject.DOMMatchElementIconStyleClassName = "dom-match-element-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName = "dom-match-text-node-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName = "dom-match-comment-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName = "dom-match-document-type-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName = "dom-match-character-data-icon";
-WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName = "dom-match-node-icon";
+    // Static
 
-WebInspector.DOMSearchMatchObject.TypeIdentifier = "dom-search-match-object";
-WebInspector.DOMSearchMatchObject.URLCookieKey = "resource-url";
-WebInspector.DOMSearchMatchObject.TitleKey = "title";
-WebInspector.DOMSearchMatchObject.TextRangeKey = "text-range";
+    static titleForDOMNode(domNode)
+    {
+        switch (domNode.nodeType()) {
+        case Node.ELEMENT_NODE:
+            var title = "<" + domNode.nodeNameInCorrectCase();
+            for (var attribute of domNode.attributes()) {
+                title += " " + attribute.name;
+                if (attribute.value.length)
+                    title += "=\"" + attribute.value + "\"";
+            }
+            return title + ">";
 
-WebInspector.DOMSearchMatchObject.prototype = {
-    constructor: WebInspector.DOMSearchMatchObject,
-    __proto__: WebInspector.Object.prototype,
+        case Node.TEXT_NODE:
+            return "\"" + domNode.nodeValue() + "\"";
+
+        case Node.COMMENT_NODE:
+            return "<!--" + domNode.nodeValue() + "-->";
+
+        case Node.DOCUMENT_TYPE_NODE:
+            var title = "<!DOCTYPE " + domNode.nodeName();
+            if (domNode.publicId) {
+                title += " PUBLIC \"" + domNode.publicId + "\"";
+                if (domNode.systemId)
+                    title += " \"" + domNode.systemId + "\"";
+            } else if (domNode.systemId)
+                title += " SYSTEM \"" + domNode.systemId + "\"";
+
+            if (domNode.internalSubset)
+                title += " [" + domNode.internalSubset + "]";
+
+            return title + ">";
+
+        case Node.CDATA_SECTION_NODE:
+            return "<![CDATA[" + domNode + "]]>";
+
+        case Node.PROCESSING_INSTRUCTION_NODE:
+            var data = domNode.nodeValue();
+            var dataString = data.length ? " " + data : "";
+            var title = "<?" + domNode.nodeNameInCorrectCase() + dataString + "?>";
+            return title;
+
+        default:
+            console.error("Unknown DOM node type: ", domNode.nodeType());
+            return domNode.nodeNameInCorrectCase();
+        }
+    }
 
     // Public
 
     get resource()
     {
         return this._resource;
-    },
+    }
 
     get domNode()
     {
         return this._domNode;
-    },
+    }
 
     get title()
     {
         return this._title;
-    },
+    }
 
     get className()
     {
@@ -76,17 +111,17 @@ WebInspector.DOMSearchMatchObject.prototype = {
             this._className = this._generateClassName();
 
         return this._className;
-    },
+    }
 
     get searchTerm()
     {
         return this._searchTerm;
-    },
+    }
 
     get sourceCodeTextRange()
     {
         return this._sourceCodeTextRange;
-    },
+    }
 
     saveIdentityToCookie(cookie)
     {
@@ -94,7 +129,7 @@ WebInspector.DOMSearchMatchObject.prototype = {
         cookie[WebInspector.DOMSearchMatchObject.TitleKey] = this._title;
         var textRange = this._sourceCodeTextRange.textRange;
         cookie[WebInspector.DOMSearchMatchObject.TextRangeKey] = [textRange.startLine, textRange.startColumn, textRange.endLine, textRange.endColumn].join();
-    },
+    }
 
     // Private
 
@@ -127,49 +162,14 @@ WebInspector.DOMSearchMatchObject.prototype = {
     }
 };
 
-WebInspector.DOMSearchMatchObject.titleForDOMNode = function(domNode)
-{
-    switch (domNode.nodeType()) {
-    case Node.ELEMENT_NODE:
-        var title = "<" + domNode.nodeNameInCorrectCase();
-        for (var attribute of domNode.attributes()) {
-            title += " " + attribute.name;
-            if (attribute.value.length)
-                title += "=\"" + attribute.value + "\"";
-        }
-        return title + ">";
-
-    case Node.TEXT_NODE:
-        return "\"" + domNode.nodeValue() + "\"";
-
-    case Node.COMMENT_NODE:
-        return "<!--" + domNode.nodeValue() + "-->";
-
-    case Node.DOCUMENT_TYPE_NODE:
-        var title = "<!DOCTYPE " + domNode.nodeName();
-        if (domNode.publicId) {
-            title += " PUBLIC \"" + domNode.publicId + "\"";
-            if (domNode.systemId)
-                title += " \"" + domNode.systemId + "\"";
-        } else if (domNode.systemId)
-            title += " SYSTEM \"" + domNode.systemId + "\"";
-
-        if (domNode.internalSubset)
-            title += " [" + domNode.internalSubset + "]";
-
-        return title + ">";
-
-    case Node.CDATA_SECTION_NODE:
-        return "<![CDATA[" + domNode + "]]>";
-
-    case Node.PROCESSING_INSTRUCTION_NODE:
-        var data = domNode.nodeValue();
-        var dataString = data.length ? " " + data : "";
-        var title = "<?" + domNode.nodeNameInCorrectCase() + dataString + "?>";
-        return title;
+WebInspector.DOMSearchMatchObject.DOMMatchElementIconStyleClassName = "dom-match-element-icon";
+WebInspector.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName = "dom-match-text-node-icon";
+WebInspector.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName = "dom-match-comment-icon";
+WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName = "dom-match-document-type-icon";
+WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName = "dom-match-character-data-icon";
+WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName = "dom-match-node-icon";
 
-    default:
-        console.error("Unknown DOM node type: ", domNode.nodeType());
-        return domNode.nodeNameInCorrectCase();
-    }
-};
+WebInspector.DOMSearchMatchObject.TypeIdentifier = "dom-search-match-object";
+WebInspector.DOMSearchMatchObject.URLCookieKey = "resource-url";
+WebInspector.DOMSearchMatchObject.TitleKey = "title";
+WebInspector.DOMSearchMatchObject.TextRangeKey = "text-range";
index 8f17597..da3a7b6 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMStorageObject = function(id, host, isLocalStorage)
+WebInspector.DOMStorageObject = class DOMStorageObject extends WebInspector.Object
 {
-    this._id = id;
-    this._host = host;
-    this._isLocalStorage = isLocalStorage;
-    this._entries = new Map;
-};
-
-WebInspector.DOMStorageObject.TypeIdentifier = "dom-storage";
-WebInspector.DOMStorageObject.HostCookieKey = "dom-storage-object-host";
-WebInspector.DOMStorageObject.LocalStorageCookieKey = "dom-storage-object-local-storage";
+    constructor(id, host, isLocalStorage)
+    {
+        super();
 
-WebInspector.DOMStorageObject.Event = {
-    ItemsCleared: "dom-storage-object-items-cleared",
-    ItemAdded: "dom-storage-object-item-added",
-    ItemRemoved: "dom-storage-object-item-removed",
-    ItemUpdated: "dom-storage-object-updated",
-};
+        this._id = id;
+        this._host = host;
+        this._isLocalStorage = isLocalStorage;
+        this._entries = new Map;
+    }
 
-WebInspector.DOMStorageObject.prototype = {
-    constructor: WebInspector.DOMStorageObject,
-    __proto__: WebInspector.Object.prototype,
+    // Public
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get host()
     {
         return this._host;
-    },
+    }
 
     get entries()
     {
         return this._entries;
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.DOMStorageObject.HostCookieKey] = this.host;
         cookie[WebInspector.DOMStorageObject.LocalStorageCookieKey] = this.isLocalStorage();
-    },
+    }
 
-    isLocalStorage: function()
+    isLocalStorage()
     {
         return this._isLocalStorage;
-    },
+    }
 
-    getEntries: function(callback)
+    getEntries(callback)
     {
         function innerCallback(error, entries)
         {
@@ -93,40 +84,51 @@ WebInspector.DOMStorageObject.prototype = {
             DOMStorageAgent.getDOMStorageEntries(this._id, innerCallback.bind(this));
         else
             DOMStorageAgent.getDOMStorageItems(this._id, innerCallback.bind(this));
-    },
+    }
 
-    removeItem: function(key)
+    removeItem(key)
     {
         DOMStorageAgent.removeDOMStorageItem(this._id, key);
-    },
+    }
 
-    setItem: function(key, value)
+    setItem(key, value)
     {
         DOMStorageAgent.setDOMStorageItem(this._id, key, value);
-    },
+    }
 
-    itemsCleared: function()
+    itemsCleared()
     {
         this._entries.clear();
         this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemsCleared);
-    },
+    }
 
-    itemRemoved: function(key)
+    itemRemoved(key)
     {
         this._entries.delete(key);
         this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemRemoved, {key});
-    },
+    }
 
-    itemAdded: function(key, value)
+    itemAdded(key, value)
     {
         this._entries.set(key, value);
         this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemAdded, {key, value});
-    },
+    }
 
-    itemUpdated: function(key, oldValue, value)
+    itemUpdated(key, oldValue, value)
     {
         this._entries.set(key, value);
         var data = {key, oldValue, value};
         this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemUpdated, data);
     }
 };
+
+WebInspector.DOMStorageObject.TypeIdentifier = "dom-storage";
+WebInspector.DOMStorageObject.HostCookieKey = "dom-storage-object-host";
+WebInspector.DOMStorageObject.LocalStorageCookieKey = "dom-storage-object-local-storage";
+
+WebInspector.DOMStorageObject.Event = {
+    ItemsCleared: "dom-storage-object-items-cleared",
+    ItemAdded: "dom-storage-object-item-added",
+    ItemRemoved: "dom-storage-object-item-removed",
+    ItemUpdated: "dom-storage-object-updated",
+};
index 00c5f50..e8ad40c 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTree = function(frame)
+WebInspector.DOMTree = class DOMTree extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._frame = frame;
-
-    this._rootDOMNode = null;
-    this._requestIdentifier = 0;
-    this._flowMap = {};
-
-    this._frame.addEventListener(WebInspector.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextChanged, this);
+    constructor(frame)
+    {
+        super();
 
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DocumentUpdated, this._documentUpdated, this);
+        this._frame = frame;
 
-    // Only add extra event listeners when not the main frame. Since DocumentUpdated is enough for the main frame.
-    if (!this._frame.isMainFrame()) {
-        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved, this._nodeRemoved, this);
-        this._frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._frameMainResourceDidChange, this);
-    }
+        this._rootDOMNode = null;
+        this._requestIdentifier = 0;
+        this._flowMap = {};
 
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowListWasUpdated, this._contentFlowListWasUpdated, this);
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasAdded, this._contentFlowWasAdded, this);
-    WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, this._contentFlowWasRemoved, this);
-};
+        this._frame.addEventListener(WebInspector.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextChanged, this);
 
-WebInspector.Object.addConstructorFunctions(WebInspector.DOMTree);
+        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DocumentUpdated, this._documentUpdated, this);
 
-WebInspector.DOMTree.Event = {
-    RootDOMNodeInvalidated: "dom-tree-root-dom-node-invalidated",
-    ContentFlowWasAdded: "dom-tree-content-flow-was-added",
-    ContentFlowWasRemoved: "dom-tree-content-flow-was-removed"
-};
+        // Only add extra event listeners when not the main frame. Since DocumentUpdated is enough for the main frame.
+        if (!this._frame.isMainFrame()) {
+            WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved, this._nodeRemoved, this);
+            this._frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._frameMainResourceDidChange, this);
+        }
 
-WebInspector.DOMTree.prototype = {
-    constructor: WebInspector.DOMTree,
+        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowListWasUpdated, this._contentFlowListWasUpdated, this);
+        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasAdded, this._contentFlowWasAdded, this);
+        WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved, this._contentFlowWasRemoved, this);
+    }
 
     // Public
 
     get frame()
     {
         return this._frame;
-    },
+    }
 
     get flowMap()
     {
         return this._flowMap;
-    },
+    }
 
     get flowsCount()
     {
         return Object.keys(this._flowMap).length;
-    },
+    }
 
-    invalidate: function()
+    invalidate()
     {
         // Set to null so it is fetched again next time requestRootDOMNode is called.
         this._rootDOMNode = null;
@@ -97,9 +88,9 @@ WebInspector.DOMTree.prototype = {
 
         // Delay the invalidation on a timeout to coalesce multiple calls to invalidate.
         this._invalidateTimeoutIdentifier = setTimeout(performInvalidate.bind(this), 0);
-    },
+    }
 
-    requestRootDOMNode: function(callback)
+    requestRootDOMNode(callback)
     {
         console.assert(typeof callback === "function");
         if (typeof callback !== "function")
@@ -125,11 +116,19 @@ WebInspector.DOMTree.prototype = {
 
         this._pendingRootDOMNodeRequests = [callback];
         this._requestRootDOMNode();
-    },
+    }
+
+    requestContentFlowList()
+    {
+        this.requestRootDOMNode(function(rootNode) {
+            // Let the backend know we are interested about the named flow events for this document.
+            WebInspector.domTreeManager.getNamedFlowCollection(rootNode.id);
+        });
+    }
 
     // Private
 
-    _requestRootDOMNode: function()
+    _requestRootDOMNode()
     {
         console.assert(this._frame.isMainFrame() || !WebInspector.ExecutionContext.supported() || this._frame.pageExecutionContext);
         console.assert(this._pendingRootDOMNodeRequests.length);
@@ -213,9 +212,9 @@ WebInspector.DOMTree.prototype = {
             var contextId = this._frame.pageExecutionContext ? this._frame.pageExecutionContext.id : undefined;
             RuntimeAgent.evaluate.invoke({expression: "document", objectGroup: "", includeCommandLineAPI: false, doNotPauseOnExceptionsAndMuteConsole: true, contextId, frameId: this._frame.id, returnByValue: false, generatePreview: false}, rootObjectAvailable.bind(this));
         }
-    },
+    }
 
-    _nodeRemoved: function(event)
+    _nodeRemoved(event)
     {
         console.assert(!this._frame.isMainFrame());
 
@@ -223,21 +222,21 @@ WebInspector.DOMTree.prototype = {
             return;
 
         this.invalidate();
-    },
+    }
 
-    _documentUpdated: function(event)
+    _documentUpdated(event)
     {
         this.invalidate();
-    },
+    }
 
-    _frameMainResourceDidChange: function(event)
+    _frameMainResourceDidChange(event)
     {
         console.assert(!this._frame.isMainFrame());
 
         this.invalidate();
-    },
+    }
 
-    _framePageExecutionContextChanged: function(event)
+    _framePageExecutionContextChanged(event)
     {
         if (this._rootDOMNodeRequestWaitingForExecutionContext) {
             console.assert(this._frame.pageExecutionContext);
@@ -247,22 +246,14 @@ WebInspector.DOMTree.prototype = {
 
             this._requestRootDOMNode();
         }
-    },
-
-    requestContentFlowList: function()
-    {
-        this.requestRootDOMNode(function(rootNode) {
-            // Let the backend know we are interested about the named flow events for this document.
-            WebInspector.domTreeManager.getNamedFlowCollection(rootNode.id);
-        });
-    },
+    }
 
-    _isContentFlowInCurrentDocument: function(flow)
+    _isContentFlowInCurrentDocument(flow)
     {
         return this._rootDOMNode && this._rootDOMNode.id === flow.documentNodeIdentifier;
-    },
+    }
 
-    _contentFlowListWasUpdated: function(event)
+    _contentFlowListWasUpdated(event)
     {
         if (!this._rootDOMNode || this._rootDOMNode.id !== event.data.documentNodeIdentifier)
             return;
@@ -302,9 +293,9 @@ WebInspector.DOMTree.prototype = {
 
         for (var i = 0; i < newFlows.length; ++i)
             this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasAdded, {flow: newFlows[i]});
-    },
+    }
 
-    _contentFlowWasAdded: function(event)
+    _contentFlowWasAdded(event)
     {
         var flow = event.data.flow;
         if (!this._isContentFlowInCurrentDocument(flow))
@@ -315,9 +306,9 @@ WebInspector.DOMTree.prototype = {
         this._flowMap[flowId] = flow;
 
         this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasAdded, {flow});
-    },
+    }
 
-    _contentFlowWasRemoved: function(event)
+    _contentFlowWasRemoved(event)
     {
         var flow = event.data.flow;
         if (!this._isContentFlowInCurrentDocument(flow))
@@ -331,4 +322,8 @@ WebInspector.DOMTree.prototype = {
     }
 };
 
-WebInspector.DOMTree.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.DOMTree.Event = {
+    RootDOMNodeInvalidated: "dom-tree-root-dom-node-invalidated",
+    ContentFlowWasAdded: "dom-tree-content-flow-was-added",
+    ContentFlowWasRemoved: "dom-tree-content-flow-was-removed"
+};
index 3b177b6..7eb2001 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseObject = function(id, host, name, version)
+WebInspector.DatabaseObject = class DatabaseObject extends WebInspector.Object
 {
-    this._id = id;
-    this._host = host ? host : WebInspector.UIString("Local File");
-    this._name = name;
-    this._version = version;
-};
-
-WebInspector.DatabaseObject.TypeIdentifier = "database";
-WebInspector.DatabaseObject.HostCookieKey = "database-object-host";
-WebInspector.DatabaseObject.NameCookieKey = "database-object-name";
+    constructor(id, host, name, version)
+    {
+        super();
 
-WebInspector.DatabaseObject.prototype = {
-    constructor: WebInspector.DatabaseObject,
+        this._id = id;
+        this._host = host ? host : WebInspector.UIString("Local File");
+        this._name = name;
+        this._version = version;
+    }
 
     // Public
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get host()
     {
         return this._host;
-    },
+    }
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get version()
     {
         return this._version;
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.DatabaseObject.HostCookieKey] = this.host;
         cookie[WebInspector.DatabaseObject.NameCookieKey] = this.name;
-    },
+    }
 
-    getTableNames: function(callback)
+    getTableNames(callback)
     {
         function sortingCallback(error, names)
         {
@@ -75,9 +72,9 @@ WebInspector.DatabaseObject.prototype = {
         }
 
         DatabaseAgent.getDatabaseTableNames(this._id, sortingCallback);
-    },
+    }
 
-    executeSQL: function(query, successCallback, errorCallback)
+    executeSQL(query, successCallback, errorCallback)
     {
         function queryCallback(columnNames, values, sqlError)
         {
@@ -133,3 +130,7 @@ WebInspector.DatabaseObject.prototype = {
         DatabaseAgent.executeSQL(this._id, query, callback);
     }
 };
+
+WebInspector.DatabaseObject.TypeIdentifier = "database";
+WebInspector.DatabaseObject.HostCookieKey = "database-object-host";
+WebInspector.DatabaseObject.NameCookieKey = "database-object-name";
index a6a8ba5..0c4e3e6 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseTableObject = function(name, database)
+WebInspector.DatabaseTableObject = class DatabaseTableObject extends WebInspector.Object
 {
-    console.assert(database instanceof WebInspector.DatabaseObject);
+    constructor(name, database)
+    {
+        super();
 
-    this._name = name;
-    this._database = database;
-};
+        console.assert(database instanceof WebInspector.DatabaseObject);
 
-WebInspector.DatabaseTableObject.TypeIdentifier = "database-table";
-WebInspector.DatabaseTableObject.NameCookieKey = "database-table-object-name";
+        this._name = name;
+        this._database = database;
+    }
 
-WebInspector.DatabaseTableObject.prototype = {
-    constructor: WebInspector.DatabaseTableObject,
+    // Public
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get database()
     {
         return this._database;
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.DatabaseTableObject.NameCookieKey] = this.name;
-    },
+    }
 };
 
-WebInspector.DatabaseTableObject.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.DatabaseTableObject.TypeIdentifier = "database-table";
+WebInspector.DatabaseTableObject.NameCookieKey = "database-table-object-name";
index d713943..2937c9a 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerDashboard = function() {
-    WebInspector.Object.call(this);
-};
-
-WebInspector.DebuggerDashboard.prototype = {
-    constructor: WebInspector.DebuggerDashboard,
-    __proto__: WebInspector.Object.prototype,
+WebInspector.DebuggerDashboard = class DebuggerDashboard extends WebInspector.Object
+{
+    constructor()
+    {
+        // FIXME: Remove once <https://webkit.org/b/142862> is fixed.
+        super();
+    }
 };
index f104dca..ceee6e6 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DefaultDashboard = function() {
-    WebInspector.Object.call(this);
-
-    this._waitingForFirstMainResourceToStartTrackingSize = true;
-
-    // Necessary event required to track page load time and resource sizes.
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-    WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
-
-    // Necessary events required to track load of resources.
-    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
-    WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
-
-    // Necessary events required to track console messages.
-    var logManager = WebInspector.logManager;
-    logManager.addEventListener(WebInspector.LogManager.Event.Cleared, this._consoleWasCleared, this);
-    logManager.addEventListener(WebInspector.LogManager.Event.ActiveLogCleared, this._consoleWasCleared, this);
-    logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, this._consoleMessageAdded, this);
-    logManager.addEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, this._consoleMessageWasRepeated, this);
-
-    this._resourcesCount = 0;
-    this._resourcesSize = 0;
-    this._time = 0;
-    this._logs = 0;
-    this._errors = 0;
-    this._issues = 0;
-};
+WebInspector.DefaultDashboard = class DefaultDashboard extends WebInspector.Object
+{
+    constructor()
+    {
+        super();
 
-WebInspector.DefaultDashboard.Event = {
-    DataDidChange: "default-dashboard-data-did-change"
-};
+        this._waitingForFirstMainResourceToStartTrackingSize = true;
 
-WebInspector.DefaultDashboard.prototype = {
-    constructor: WebInspector.DefaultDashboard,
-    __proto__: WebInspector.Object.prototype,
+        // Necessary event required to track page load time and resource sizes.
+        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
+
+        // Necessary events required to track load of resources.
+        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
+        WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
+
+        // Necessary events required to track console messages.
+        var logManager = WebInspector.logManager;
+        logManager.addEventListener(WebInspector.LogManager.Event.Cleared, this._consoleWasCleared, this);
+        logManager.addEventListener(WebInspector.LogManager.Event.ActiveLogCleared, this._consoleWasCleared, this);
+        logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, this._consoleMessageAdded, this);
+        logManager.addEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, this._consoleMessageWasRepeated, this);
+
+        this._resourcesCount = 0;
+        this._resourcesSize = 0;
+        this._time = 0;
+        this._logs = 0;
+        this._errors = 0;
+        this._issues = 0;
+    }
 
     // Public
 
     get resourcesCount()
     {
         return this._resourcesCount;
-    },
+    }
 
     set resourcesCount(value)
     {
         this._resourcesCount = value;
         this._dataDidChange();
-    },
+    }
 
     get resourcesSize()
     {
         return this._resourcesSize;
-    },
+    }
 
     set resourcesSize(value)
     {
         this._resourcesSize = value;
         this._dataDidChange();
-    },
+    }
 
     get time()
     {
         return this._time;
-    },
+    }
 
     set time(value)
     {
         this._time = value;
         this._dataDidChange();
-    },
+    }
 
     get logs()
     {
         return this._logs;
-    },
+    }
 
     set logs(value)
     {
         this._logs = value;
         this._dataDidChange();
-    },
+    }
 
     get errors()
     {
         return this._errors;
-    },
+    }
 
     set errors(value)
     {
         this._errors = value;
         this._dataDidChange();
-    },
+    }
 
     get issues()
     {
         return this._issues;
-    },
+    }
 
     set issues(value)
     {
         this._issues = value;
         this._dataDidChange();
-    },
+    }
 
     // Private
 
-    _dataDidChange: function()
+    _dataDidChange()
     {
         this.dispatchEventToListeners(WebInspector.DefaultDashboard.Event.DataDidChange);
-    },
+    }
 
-    _mainResourceDidChange: function(event)
+    _mainResourceDidChange(event)
     {
         console.assert(event.target instanceof WebInspector.Frame);
 
@@ -158,30 +153,30 @@ WebInspector.DefaultDashboard.prototype = {
 
         this._dataDidChange();
         this._startUpdatingTime();
-    },
+    }
 
-    _capturingStopped: function(event)
+    _capturingStopped(event)
     {
         // If recording stops, we should stop the timer if it hasn't stopped already.
         this._stopUpdatingTime();
-    },
+    }
 
-    _resourceWasAdded: function(event)
+    _resourceWasAdded(event)
     {
         ++this.resourcesCount;
-    },
+    }
 
-    _frameWasAdded: function(event)
+    _frameWasAdded(event)
     {
         ++this.resourcesCount;
-    },
+    }
 
-    _resourceSizeDidChange: function(event)
+    _resourceSizeDidChange(event)
     {
         this.resourcesSize += event.target.size - event.data.previousSize;
-    },
+    }
 
-    _startUpdatingTime: function()
+    _startUpdatingTime()
     {
         this._stopUpdatingTime();
 
@@ -190,18 +185,18 @@ WebInspector.DefaultDashboard.prototype = {
         this._timelineBaseTime = Date.now();
         this._timeIntervalDelay = 50;
         this._timeIntervalIdentifier = setInterval(this._updateTime.bind(this), this._timeIntervalDelay);
-    },
+    }
 
-    _stopUpdatingTime: function()
+    _stopUpdatingTime()
     {
         if (!this._timeIntervalIdentifier)
             return;
 
         clearInterval(this._timeIntervalIdentifier);
         delete this._timeIntervalIdentifier;
-    },
+    }
 
-    _updateTime: function()
+    _updateTime()
     {
         var duration = Date.now() - this._timelineBaseTime;
 
@@ -232,21 +227,21 @@ WebInspector.DefaultDashboard.prototype = {
         this.time = mainFrameLoadEventTime - mainFrameStartTime;
 
         this._stopUpdatingTime();
-    },
+    }
 
-    _consoleMessageAdded: function(event)
+    _consoleMessageAdded(event)
     {
         var message = event.data.message;
         this._lastConsoleMessageType = message.level;
         this._incrementConsoleMessageType(message.level, message.totalRepeatCount);
-    },
+    }
 
-    _consoleMessageWasRepeated: function(event)
+    _consoleMessageWasRepeated(event)
     {
         this._incrementConsoleMessageType(this._lastConsoleMessageType, 1);
-    },
+    }
 
-    _incrementConsoleMessageType: function(type, increment)
+    _incrementConsoleMessageType(type, increment)
     {
         switch (type) {
         case WebInspector.LegacyConsoleMessage.MessageLevel.Log:
@@ -259,9 +254,9 @@ WebInspector.DefaultDashboard.prototype = {
             this.errors += increment;
             break;
         }
-    },
+    }
 
-    _consoleWasCleared: function(event)
+    _consoleWasCleared(event)
     {
         this._logs = 0;
         this._issues = 0;
@@ -269,3 +264,7 @@ WebInspector.DefaultDashboard.prototype = {
         this._dataDidChange();
     }
 };
+
+WebInspector.DefaultDashboard.Event = {
+    DataDidChange: "default-dashboard-data-did-change"
+};
index 14375e1..b5aef98 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ExecutionContext = function(id, name, isPageContext, frame)
+WebInspector.ExecutionContext = class ExecutionContext extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
+    constructor(id, name, isPageContext, frame)
+    {
+        super();
 
-    console.assert(typeof id === "number" || id === WebInspector.QuickConsole.MainFrameContextExecutionIdentifier);
-    console.assert(typeof name === "string");
+        console.assert(typeof id === "number" || id === WebInspector.QuickConsole.MainFrameContextExecutionIdentifier);
+        console.assert(typeof name === "string");
 
-    this._id = id;
-    this._name = name;
-    this._isPageContext = isPageContext || false;
-    this._frame = frame || null;
-};
+        this._id = id;
+        this._name = name;
+        this._isPageContext = isPageContext || false;
+        this._frame = frame || null;
+    }
 
-WebInspector.ExecutionContext.supported = function()
-{
-    // Execution contexts were added to the Inspector protocol alongside RuntimeAgent.enable and
-    // disable methods, which turn on and off sending Runtime agent execution context created events.
-    // So we can feature detect support for execution contexts with these RuntimeAgent functions.
-    return typeof RuntimeAgent.enable === "function";
-};
+    // Static
 
-WebInspector.ExecutionContext.prototype = {
-    constructor: WebInspector.ExecutionContext,
+    static supported()
+    {
+        // Execution contexts were added to the Inspector protocol alongside RuntimeAgent.enable and
+        // disable methods, which turn on and off sending Runtime agent execution context created events.
+        // So we can feature detect support for execution contexts with these RuntimeAgent functions.
+        return typeof RuntimeAgent.enable === "function";
+    }
 
     // Public
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get isPageContext()
     {
         return this._isPageContext;
-    },
+    }
 
     get frame()
     {
         return this._frame;
     }
 };
-
-WebInspector.ExecutionContext.prototype.__proto__ = WebInspector.Object.prototype;
index c806c27..e094fc7 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ExecutionContextList = function()
+WebInspector.ExecutionContextList = class ExecutionContextList extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._contexts = [];
-    this._pageExecutionContext = null;
-};
+    constructor()
+    {
+        super();
 
-WebInspector.ExecutionContextList.prototype = {
-    constructor: WebInspector.ExecutionContextList,
+        this._contexts = [];
+        this._pageExecutionContext = null;
+    }
 
     // Public
 
     get pageExecutionContext()
     {
         return this._pageExecutionContext;
-    },
+    }
 
     get contexts()
     {
         return this._contexts;
-    },
+    }
 
-    add: function(context)
+    add(context)
     {
         // FIXME: The backend sends duplicate page context execution contexts with the same id. Why?
         if (context.isPageContext && this._pageExecutionContext) {
@@ -63,13 +62,11 @@ WebInspector.ExecutionContextList.prototype = {
         }
 
         return false;
-    },
+    }
 
-    clear: function()
+    clear()
     {
         this._contexts = [];
         this._pageExecutionContext = null;
     }
 };
-
-WebInspector.ExecutionContextList.prototype.__proto__ = WebInspector.Object.prototype;
index 8454f22..0619c47 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Frame = function(id, name, securityOrigin, loaderIdentifier, mainResource)
+WebInspector.Frame = class Frame extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    console.assert(id);
-
-    this._id = id;
-
-    this._name = null;
-    this._securityOrigin = null;
-
-    this._resourceCollection = new WebInspector.ResourceCollection;
-    this._provisionalResourceCollection = new WebInspector.ResourceCollection;
+    constructor(id, name, securityOrigin, loaderIdentifier, mainResource)
+    {
+        super();
 
-    this._childFrames = [];
-    this._childFrameIdentifierMap = {};
+        console.assert(id);
 
-    this._parentFrame = null;
-    this._isMainFrame = false;
+        this._id = id;
 
-    this._domContentReadyEventTimestamp = NaN;
-    this._loadEventTimestamp = NaN;
+        this._name = null;
+        this._securityOrigin = null;
 
-    this._executionContextList = new WebInspector.ExecutionContextList;
+        this._resourceCollection = new WebInspector.ResourceCollection;
+        this._provisionalResourceCollection = new WebInspector.ResourceCollection;
 
-    this.initialize(name, securityOrigin, loaderIdentifier, mainResource);
-};
+        this._childFrames = [];
+        this._childFrameIdentifierMap = {};
 
-WebInspector.Object.addConstructorFunctions(WebInspector.Frame);
+        this._parentFrame = null;
+        this._isMainFrame = false;
 
-WebInspector.Frame.Event = {
-    NameDidChange: "frame-name-did-change",
-    SecurityOriginDidChange: "frame-security-origin-did-change",
-    MainResourceDidChange: "frame-main-resource-did-change",
-    ProvisionalLoadStarted: "frame-provisional-load-started",
-    ProvisionalLoadCommitted: "frame-provisional-load-committed",
-    ProvisionalLoadCleared: "frame-provisional-load-cleared",
-    ProvisionalResourceWasAdded: "frame-provisional-resource-was-added",
-    ResourceWasAdded: "frame-resource-was-added",
-    ResourceWasRemoved: "frame-resource-was-removed",
-    AllResourcesRemoved: "frame-all-resources-removed",
-    ChildFrameWasAdded: "frame-child-frame-was-added",
-    ChildFrameWasRemoved: "frame-child-frame-was-removed",
-    AllChildFramesRemoved: "frame-all-child-frames-removed",
-    PageExecutionContextChanged: "frame-page-execution-context-changed",
-    ExecutionContextsCleared: "frame-execution-contexts-cleared"
-};
+        this._domContentReadyEventTimestamp = NaN;
+        this._loadEventTimestamp = NaN;
 
-WebInspector.Frame.TypeIdentifier = "Frame";
-WebInspector.Frame.MainResourceURLCookieKey = "frame-main-resource-url";
-WebInspector.Frame.IsMainFrameCookieKey = "frame-is-main-frame";
+        this._executionContextList = new WebInspector.ExecutionContextList;
 
-WebInspector.Frame.prototype = {
-    constructor: WebInspector.Frame,
+        this.initialize(name, securityOrigin, loaderIdentifier, mainResource);
+    }
 
     // Public
 
-    initialize: function(name, securityOrigin, loaderIdentifier, mainResource)
+    initialize(name, securityOrigin, loaderIdentifier, mainResource)
     {
         console.assert(loaderIdentifier);
         console.assert(mainResource);
@@ -112,9 +87,9 @@ WebInspector.Frame.prototype = {
 
         if (this._name !== oldName)
             this.dispatchEventToListeners(WebInspector.Frame.Event.NameDidChange, {oldName});
-    },
+    }
 
-    startProvisionalLoad: function(provisionalMainResource)
+    startProvisionalLoad(provisionalMainResource)
     {
         console.assert(provisionalMainResource);
 
@@ -126,9 +101,9 @@ WebInspector.Frame.prototype = {
         this._provisionalResourceCollection.removeAllResources();
 
         this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadStarted);
-    },
+    }
 
-    commitProvisionalLoad: function(securityOrigin)
+    commitProvisionalLoad(securityOrigin)
     {
         console.assert(this._provisionalMainResource);
         console.assert(this._provisionalLoaderIdentifier);
@@ -164,9 +139,9 @@ WebInspector.Frame.prototype = {
 
         if (this._securityOrigin !== oldSecurityOrigin)
             this.dispatchEventToListeners(WebInspector.Frame.Event.SecurityOriginDidChange, {oldSecurityOrigin});
-    },
+    }
 
-    clearProvisionalLoad: function(skipProvisionalLoadClearedEvent)
+    clearProvisionalLoad(skipProvisionalLoadClearedEvent)
     {
         if (!this._provisionalLoaderIdentifier)
             return;
@@ -177,127 +152,127 @@ WebInspector.Frame.prototype = {
 
         if (!skipProvisionalLoadClearedEvent)
             this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadCleared);
-    },
+    }
 
     get id()
     {
         return this._id;
-    },
+    }
 
     get loaderIdentifier()
     {
         return this._loaderIdentifier;
-    },
+    }
 
     get provisionalLoaderIdentifier()
     {
         return this._provisionalLoaderIdentifier;
-    },
+    }
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get securityOrigin()
     {
         return this._securityOrigin;
-    },
+    }
 
     get url()
     {
         return this._mainResource._url;
-    },
+    }
 
     get domTree()
     {
         if (!this._domTree)
             this._domTree = new WebInspector.DOMTree(this);
         return this._domTree;
-    },
+    }
 
     get pageExecutionContext()
     {
         return this._executionContextList.pageExecutionContext;
-    },
+    }
 
     get executionContextList()
     {
         return this._executionContextList;
-    },
+    }
 
-    clearExecutionContexts: function(committingProvisionalLoad)
+    clearExecutionContexts(committingProvisionalLoad)
     {
         if (this._executionContextList.contexts.length) {
             this._executionContextList.clear();
             this.dispatchEventToListeners(WebInspector.Frame.Event.ExecutionContextsCleared, {committingProvisionalLoad:!!committingProvisionalLoad});
         }
-    },
+    }
 
-    addExecutionContext: function(context)
+    addExecutionContext(context)
     {
         var changedPageContext = this._executionContextList.add(context);
 
         if (changedPageContext)
             this.dispatchEventToListeners(WebInspector.Frame.Event.PageExecutionContextChanged);
-    },
+    }
 
     get mainResource()
     {
         return this._mainResource;
-    },
+    }
 
     get provisionalMainResource()
     {
         return this._provisionalMainResource;
-    },
+    }
 
     get parentFrame()
     {
         return this._parentFrame;
-    },
+    }
 
     get childFrames()
     {
         return this._childFrames;
-    },
+    }
 
     get domContentReadyEventTimestamp()
     {
         return this._domContentReadyEventTimestamp;
-    },
+    }
 
     get loadEventTimestamp()
     {
         return this._loadEventTimestamp;
-    },
+    }
 
-    isMainFrame: function()
+    isMainFrame()
     {
         return this._isMainFrame;
-    },
+    }
 
-    markAsMainFrame: function()
+    markAsMainFrame()
     {
         this._isMainFrame = true;
-    },
+    }
 
-    unmarkAsMainFrame: function()
+    unmarkAsMainFrame()
     {
         this._isMainFrame = false;
-    },
+    }
 
-    markDOMContentReadyEvent: function(timestamp)
+    markDOMContentReadyEvent(timestamp)
     {
         this._domContentReadyEventTimestamp = timestamp || NaN;
-    },
+    }
 
-    markLoadEvent: function(timestamp)
+    markLoadEvent(timestamp)
     {
         this._loadEventTimestamp = timestamp || NaN;
-    },
+    }
 
-    isDetached: function()
+    isDetached()
     {
         var frame = this;
         while (frame) {
@@ -307,14 +282,14 @@ WebInspector.Frame.prototype = {
         }
 
         return true;
-    },
+    }
 
-    childFrameForIdentifier: function(frameId)
+    childFrameForIdentifier(frameId)
     {
         return this._childFrameIdentifierMap[frameId] || null;
-    },
+    }
 
-    addChildFrame: function(frame)
+    addChildFrame(frame)
     {
         console.assert(frame instanceof WebInspector.Frame);
         if (!(frame instanceof WebInspector.Frame))
@@ -332,9 +307,9 @@ WebInspector.Frame.prototype = {
         frame._parentFrame = this;
 
         this.dispatchEventToListeners(WebInspector.Frame.Event.ChildFrameWasAdded, {childFrame: frame});
-    },
+    }
 
-    removeChildFrame: function(frameOrFrameId)
+    removeChildFrame(frameOrFrameId)
     {
         console.assert(frameOrFrameId);
 
@@ -359,9 +334,9 @@ WebInspector.Frame.prototype = {
         childFrame._parentFrame = null;
 
         this.dispatchEventToListeners(WebInspector.Frame.Event.ChildFrameWasRemoved, {childFrame});
-    },
+    }
 
-    removeAllChildFrames: function()
+    removeAllChildFrames()
     {
         if (!this._childFrames.length)
             return;
@@ -373,14 +348,14 @@ WebInspector.Frame.prototype = {
         this._childFrameIdentifierMap = {};
 
         this.dispatchEventToListeners(WebInspector.Frame.Event.AllChildFramesRemoved);
-    },
+    }
 
     get resources()
     {
         return this._resourceCollection.resources;
-    },
+    }
 
-    resourceForURL: function(url, recursivelySearchChildFrames)
+    resourceForURL(url, recursivelySearchChildFrames)
     {
         var resource = this._resourceCollection.resourceForURL(url);
         if (resource)
@@ -404,14 +379,14 @@ WebInspector.Frame.prototype = {
         }
 
         return null;
-    },
+    }
 
-    resourcesWithType: function(type)
+    resourcesWithType(type)
     {
         return this._resourceCollection.resourcesWithType(type);
-    },
+    }
 
-    addResource: function(resource)
+    addResource(resource)
     {
         console.assert(resource instanceof WebInspector.Resource);
         if (!(resource instanceof WebInspector.Resource))
@@ -432,9 +407,9 @@ WebInspector.Frame.prototype = {
             this._resourceCollection.addResource(resource);
             this.dispatchEventToListeners(WebInspector.Frame.Event.ResourceWasAdded, {resource});
         }
-    },
+    }
 
-    removeResource: function(resourceOrURL)
+    removeResource(resourceOrURL)
     {
         // This does not remove provisional resources.
 
@@ -445,9 +420,9 @@ WebInspector.Frame.prototype = {
         this._disassociateWithResource(resource);
 
         this.dispatchEventToListeners(WebInspector.Frame.Event.ResourceWasRemoved, {resource});
-    },
+    }
 
-    removeAllResources: function()
+    removeAllResources()
     {
         // This does not remove provisional resources, use clearProvisionalLoad for that.
 
@@ -461,43 +436,63 @@ WebInspector.Frame.prototype = {
         this._resourceCollection.removeAllResources();
 
         this.dispatchEventToListeners(WebInspector.Frame.Event.AllResourcesRemoved);
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.Frame.MainResourceURLCookieKey] = this.mainResource.url.hash;
         cookie[WebInspector.Frame.IsMainFrameCookieKey] = this._isMainFrame;
-    },
+    }
 
     // Private
 
-    _isProvisionalResource: function(resource)
+    _isProvisionalResource(resource)
     {
         return (resource.loaderIdentifier && this._provisionalLoaderIdentifier && resource.loaderIdentifier === this._provisionalLoaderIdentifier);
-    },
+    }
 
-    _associateWithResource: function(resource)
+    _associateWithResource(resource)
     {
         console.assert(!resource._parentFrame);
         if (resource._parentFrame)
             return;
 
         resource._parentFrame = this;
-    },
+    }
 
-    _disassociateWithResource: function(resource)
+    _disassociateWithResource(resource)
     {
         console.assert(resource.parentFrame === this);
         if (resource.parentFrame !== this)
             return;
 
         resource._parentFrame = null;
-    },
+    }
 
-    _dispatchMainResourceDidChangeEvent: function(oldMainResource)
+    _dispatchMainResourceDidChangeEvent(oldMainResource)
     {
         this.dispatchEventToListeners(WebInspector.Frame.Event.MainResourceDidChange, {oldMainResource});
     }
 };
 
-WebInspector.Frame.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.Frame.Event = {
+    NameDidChange: "frame-name-did-change",
+    SecurityOriginDidChange: "frame-security-origin-did-change",
+    MainResourceDidChange: "frame-main-resource-did-change",
+    ProvisionalLoadStarted: "frame-provisional-load-started",
+    ProvisionalLoadCommitted: "frame-provisional-load-committed",
+    ProvisionalLoadCleared: "frame-provisional-load-cleared",
+    ProvisionalResourceWasAdded: "frame-provisional-resource-was-added",
+    ResourceWasAdded: "frame-resource-was-added",
+    ResourceWasRemoved: "frame-resource-was-removed",
+    AllResourcesRemoved: "frame-all-resources-removed",
+    ChildFrameWasAdded: "frame-child-frame-was-added",
+    ChildFrameWasRemoved: "frame-child-frame-was-removed",
+    AllChildFramesRemoved: "frame-all-child-frames-removed",
+    PageExecutionContextChanged: "frame-page-execution-context-changed",
+    ExecutionContextsCleared: "frame-execution-contexts-cleared"
+};
+
+WebInspector.Frame.TypeIdentifier = "Frame";
+WebInspector.Frame.MainResourceURLCookieKey = "frame-main-resource-url";
+WebInspector.Frame.IsMainFrameCookieKey = "frame-is-main-frame";
index ea5c081..0bfe276 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Point = function(x, y)
+WebInspector.Point = class Point
 {
-    this.x = x || 0;
-    this.y = y || 0;
-};
+    constructor(x, y)
+    {
+        this.x = x || 0;
+        this.y = y || 0;
+    }
 
-WebInspector.Point.fromEvent = function(event)
-{
-    return new WebInspector.Point(event.pageX, event.pageY);
-};
+    // Static
 
-WebInspector.Point.fromEventInElement = function(event, element)
-{
-    var wkPoint = window.webkitConvertPointFromPageToNode(element, new WebKitPoint(event.pageX, event.pageY));
-    return new WebInspector.Point(wkPoint.x, wkPoint.y);
-};
+    static fromEvent(event)
+    {
+        return new WebInspector.Point(event.pageX, event.pageY);
+    }
 
-WebInspector.Point.prototype = {
-    constructor: WebInspector.Point,
+    static fromEventInElement(event, element)
+    {
+        var wkPoint = window.webkitConvertPointFromPageToNode(element, new WebKitPoint(event.pageX, event.pageY));
+        return new WebInspector.Point(wkPoint.x, wkPoint.y);
+    }
 
-    toString : function()
+    // Public
+
+    toString()
     {
         return "WebInspector.Point[" + this.x + "," + this.y + "]";
-    },
+    }
 
-    copy: function()
+    copy()
     {
         return new WebInspector.Point(this.x, this.y);
-    },
+    }
 
-    equals: function(anotherPoint)
+    equals(anotherPoint)
     {
         return (this.x === anotherPoint.x && this.y === anotherPoint.y);
     }
 };
 
-WebInspector.Size = function(width, height)
+WebInspector.Size = class Size
 {
-    this.width = width || 0;
-    this.height = height || 0;
-};
+    constructor(width, height)
+    {
+        this.width = width || 0;
+        this.height = height || 0;
+    }
 
-WebInspector.Size.prototype = {
-    constructor: WebInspector.Size,
+    // Public
 
-    toString: function()
+    toString()
     {
         return "WebInspector.Size[" + this.width + "," + this.height + "]";
-    },
+    }
 
-    copy: function()
+    copy()
     {
         return new WebInspector.Size(this.width, this.height);
-    },
+    }
 
-    equals: function(anotherSize)
+    equals(anotherSize)
     {
         return (this.width === anotherSize.width && this.height === anotherSize.height);
     }
@@ -87,44 +91,47 @@ WebInspector.Size.prototype = {
 WebInspector.Size.ZERO_SIZE = new WebInspector.Size(0, 0);
 
 
-WebInspector.Rect = function(x, y, width, height)
+WebInspector.Rect = class Rect
 {
-    this.origin = new WebInspector.Point(x || 0, y || 0);
-    this.size = new WebInspector.Size(width || 0, height || 0);
-};
+    constructor(x, y, width, height)
+    {
+        this.origin = new WebInspector.Point(x || 0, y || 0);
+        this.size = new WebInspector.Size(width || 0, height || 0);
+    }
 
-WebInspector.Rect.rectFromClientRect = function(clientRect)
-{
-    return new WebInspector.Rect(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
-};
+    // Static
 
-WebInspector.Rect.unionOfRects = function(rects)
-{
-    var union = rects[0];
-    for (var i = 1; i < rects.length; ++i)
-        union = union.unionWithRect(rects[i]);
-    return union;
-};
+    static rectFromClientRect(clientRect)
+    {
+        return new WebInspector.Rect(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
+    }
 
-WebInspector.Rect.prototype = {
-    constructor: WebInspector.Rect,
+    static unionOfRects(rects)
+    {
+        var union = rects[0];
+        for (var i = 1; i < rects.length; ++i)
+            union = union.unionWithRect(rects[i]);
+        return union;
+    }
 
-    toString: function()
+    // Public
+
+    toString()
     {
         return "WebInspector.Rect[" + [this.origin.x, this.origin.y, this.size.width, this.size.height].join(", ") + "]";
-    },
+    }
 
-    copy: function()
+    copy()
     {
         return new WebInspector.Rect(this.origin.x, this.origin.y, this.size.width, this.size.height);
-    },
+    }
 
-    equals: function(anotherRect)
+    equals(anotherRect)
     {
         return (this.origin.equals(anotherRect.origin) && this.size.equals(anotherRect.size));
-    },
+    }
 
-    inset: function(insets)
+    inset(insets)
     {
         return new WebInspector.Rect(
             this.origin.x + insets.left,
@@ -132,9 +139,9 @@ WebInspector.Rect.prototype = {
             this.size.width - insets.left - insets.right,
             this.size.height - insets.top - insets.bottom
         );
-    },
+    }
 
-    pad: function(padding)
+    pad(padding)
     {
         return new WebInspector.Rect(
             this.origin.x - padding,
@@ -142,39 +149,39 @@ WebInspector.Rect.prototype = {
             this.size.width + padding * 2,
             this.size.height + padding * 2
         );
-    },
+    }
 
-    minX: function()
+    minX()
     {
         return this.origin.x;
-    },
+    }
 
-    minY: function()
+    minY()
     {
         return this.origin.y;
-    },
+    }
 
-    midX: function()
+    midX()
     {
         return this.origin.x + (this.size.width / 2);
-    },
+    }
 
-    midY: function()
+    midY()
     {
         return this.origin.y + (this.size.height / 2);
-    },
+    }
 
-    maxX: function()
+    maxX()
     {
         return this.origin.x + this.size.width;
-    },
+    }
 
-    maxY: function()
+    maxY()
     {
         return this.origin.y + this.size.height;
-    },
+    }
 
-    intersectionWithRect: function(rect)
+    intersectionWithRect(rect)
     {
         var x1 = Math.max(this.minX(), rect.minX());
         var x2 = Math.min(this.maxX(), rect.maxX());
@@ -190,18 +197,18 @@ WebInspector.Rect.prototype = {
         intersection.origin.y = y1;
         intersection.size.height = y2 - y1;
         return intersection;
-    },
+    }
 
-    unionWithRect: function(rect)
+    unionWithRect(rect)
     {
         var x = Math.min(this.minX(), rect.minX());
         var y = Math.min(this.minY(), rect.minY());
         var width = Math.max(this.maxX(), rect.maxX()) - x;
         var height = Math.max(this.maxY(), rect.maxY()) - y;
         return new WebInspector.Rect(x, y, width, height);
-    },
+    }
 
-    round: function()
+    round()
     {
         return new WebInspector.Rect(
             Math.floor(this.origin.x),
@@ -215,33 +222,34 @@ WebInspector.Rect.prototype = {
 WebInspector.Rect.ZERO_RECT = new WebInspector.Rect(0, 0, 0, 0);
 
 
-WebInspector.EdgeInsets = function(top, right, bottom, left)
+WebInspector.EdgeInsets = class EdgeInsets
 {
-    console.assert(arguments.length === 1 || arguments.length === 4);
-
-    if (arguments.length === 1) {
-        this.top = top;
-        this.right = top;
-        this.bottom = top;
-        this.left = top;
-    } else if (arguments.length === 4) {
-        this.top = top;
-        this.right = right;
-        this.bottom = bottom;
-        this.left = left;
+    constructor(top, right, bottom, left)
+    {
+        console.assert(arguments.length === 1 || arguments.length === 4);
+
+        if (arguments.length === 1) {
+            this.top = top;
+            this.right = top;
+            this.bottom = top;
+            this.left = top;
+        } else if (arguments.length === 4) {
+            this.top = top;
+            this.right = right;
+            this.bottom = bottom;
+            this.left = left;
+        }
     }
-};
 
-WebInspector.EdgeInsets.prototype = {
-    constructor: WebInspector.EdgeInsets,
+    // Public
 
-    equals: function(anotherInset)
+    equals(anotherInset)
     {
         return (this.top === anotherInset.top && this.right === anotherInset.right &&
                 this.bottom === anotherInset.bottom && this.left === anotherInset.left);
-    },
+    }
 
-    copy: function()
+    copy()
     {
         return new WebInspector.EdgeInsets(this.top, this.right, this.bottom, this.left);
     }
@@ -254,23 +262,24 @@ WebInspector.RectEdge = {
     MAX_Y : 3
 };
 
-WebInspector.Quad = function(quad)
+WebInspector.Quad = class Quad
 {
-    this.points = [
-        new WebInspector.Point(quad[0], quad[1]), // top left
-        new WebInspector.Point(quad[2], quad[3]), // top right
-        new WebInspector.Point(quad[4], quad[5]), // bottom right
-        new WebInspector.Point(quad[6], quad[7])  // bottom left
-    ];
-
-    this.width = Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1] - quad[3], 2)));
-    this.height = Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1] - quad[7], 2)));
-};
+    constructor(quad)
+    {
+        this.points = [
+            new WebInspector.Point(quad[0], quad[1]), // top left
+            new WebInspector.Point(quad[2], quad[3]), // top right
+            new WebInspector.Point(quad[4], quad[5]), // bottom right
+            new WebInspector.Point(quad[6], quad[7])  // bottom left
+        ];
+
+        this.width = Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1] - quad[3], 2)));
+        this.height = Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1] - quad[7], 2)));
+    }
 
-WebInspector.Quad.prototype = {
-    constructor: WebInspector.Quad,
+    // Public
 
-    toProtocol: function()
+    toProtocol()
     {
         return [
             this.points[0].x, this.points[0].y,
@@ -281,15 +290,16 @@ WebInspector.Quad.prototype = {
     }
 };
 
-WebInspector.Polygon = function(points)
+WebInspector.Polygon = class Polygon
 {
-    this.points = points;
-}
+    constructor(points)
+    {
+        this.points = points;
+    }
 
-WebInspector.Polygon.prototype = {
-    constructor: WebInspector.Polygon,
+    // Public
 
-    bounds: function()
+    bounds()
     {
         var minX = Number.MAX_VALUE;
         var minY = Number.MAX_VALUE;
index 7204deb..7a2d932 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// FIXME: Convert to class?
 WebInspector.Gradient = {
-    Types : {
+    Types: {
         Linear: "linear-gradient",
         Radial: "radial-gradient"
     },
 
-    fromString: function(cssString)
+    fromString(cssString)
     {
         var type;
         var openingParenthesisIndex = cssString.indexOf("(");
@@ -95,7 +96,7 @@ WebInspector.Gradient = {
         return gradient;
     },
 
-    stopsWithComponents: function(components)
+    stopsWithComponents(components)
     {
         // FIXME: handle lengths.
         var stops = components.map(function(component) {
@@ -131,7 +132,7 @@ WebInspector.Gradient = {
         return stops;
     },
 
-    stringFromStops: function(stops)
+    stringFromStops(stops)
     {
         var count = stops.length - 1;
         return stops.map(function(stop, index) {
@@ -143,74 +144,77 @@ WebInspector.Gradient = {
     }
 };
 
-WebInspector.LinearGradient = function(angle, stops)
+WebInspector.LinearGradient = class LinearGradient
 {
-    this.type = WebInspector.Gradient.Types.Linear;
-    this.angle = angle;
-    this.stops = stops;
-};
+    constructor(angle, stops)
+    {
+        this.type = WebInspector.Gradient.Types.Linear;
+        this.angle = angle;
+        this.stops = stops;
+    }
 
-WebInspector.LinearGradient.linearGradientWithComponents = function(components)
-{
-    var angle = 180;
-
-    if (components[0].length === 1 && components[0][0].substr(-3) === "deg") {
-        angle = (parseFloat(components[0][0]) % 360 + 360) % 360;
-        components.shift();
-    } else if (components[0][0] === "to") {
-        components[0].shift();
-        switch (components[0].sort().join(" ")) {
-        case "top":
-            angle = 0;
-            break;
-        case "right top":
-            angle = 45;
-            break;
-        case "right":
-            angle = 90;
-            break;
-        case "bottom right":
-            angle = 135;
-            break;
-        case "bottom":
-            angle = 180;
-            break;
-        case "bottom left":
-            angle = 225;
-            break;
-        case "left":
-            angle = 270;
-            break;
-        case "left top":
-            angle = 315;
-            break;
-        default:
-            console.error("Couldn't parse angle \"to " + components[0].join(" ") + "\"");
+    // Static
+
+    static linearGradientWithComponents(components)
+    {
+        var angle = 180;
+
+        if (components[0].length === 1 && components[0][0].substr(-3) === "deg") {
+            angle = (parseFloat(components[0][0]) % 360 + 360) % 360;
+            components.shift();
+        } else if (components[0][0] === "to") {
+            components[0].shift();
+            switch (components[0].sort().join(" ")) {
+            case "top":
+                angle = 0;
+                break;
+            case "right top":
+                angle = 45;
+                break;
+            case "right":
+                angle = 90;
+                break;
+            case "bottom right":
+                angle = 135;
+                break;
+            case "bottom":
+                angle = 180;
+                break;
+            case "bottom left":
+                angle = 225;
+                break;
+            case "left":
+                angle = 270;
+                break;
+            case "left top":
+                angle = 315;
+                break;
+            default:
+                console.error("Couldn't parse angle \"to " + components[0].join(" ") + "\"");
+                return null;
+            }
+            components.shift();
+        } else if (components[0].length !== 1 && !WebInspector.Color.fromString(components[0][0])) {
+            // If the first component is not a color, then we're dealing with a
+            // legacy linear gradient format that we don't support.
             return null;
         }
-        components.shift();
-    } else if (components[0].length !== 1 && !WebInspector.Color.fromString(components[0][0])) {
-        // If the first component is not a color, then we're dealing with a
-        // legacy linear gradient format that we don't support.
-        return null;
-    }
 
-    var stops = WebInspector.Gradient.stopsWithComponents(components);
-    if (!stops)
-        return null;
+        var stops = WebInspector.Gradient.stopsWithComponents(components);
+        if (!stops)
+            return null;
 
-    return new WebInspector.LinearGradient(angle, stops);
-};
+        return new WebInspector.LinearGradient(angle, stops);
+    }
 
-WebInspector.LinearGradient.prototype = {
-    constructor: WebInspector.LinearGradient,
+    // Public
 
-    copy: function()
+    copy()
     {
         return new WebInspector.LinearGradient(this.angle, this.stops.concat());
-    },
+    }
 
-    toString: function()
+    toString()
     {
         var str = "";
 
@@ -240,33 +244,36 @@ WebInspector.LinearGradient.prototype = {
     }
 };
 
-WebInspector.RadialGradient = function(sizing, stops)
+WebInspector.RadialGradient = class RadialGradient
 {
-    this.type = WebInspector.Gradient.Types.Radial;
-    this.sizing = sizing;
-    this.stops = stops;
-};
+    constructor(sizing, stops)
+    {
+        this.type = WebInspector.Gradient.Types.Radial;
+        this.sizing = sizing;
+        this.stops = stops;
+    }
 
-WebInspector.RadialGradient.radialGradientWithComponents = function(components)
-{
-    var sizing = !WebInspector.Color.fromString(components[0].join(" ")) ? components.shift().join(" ") : "";
+    // Static
 
-    var stops = WebInspector.Gradient.stopsWithComponents(components);
-    if (!stops)
-        return null;
+    static radialGradientWithComponents(components)
+    {
+        var sizing = !WebInspector.Color.fromString(components[0].join(" ")) ? components.shift().join(" ") : "";
 
-    return new WebInspector.RadialGradient(sizing, stops);
-};
+        var stops = WebInspector.Gradient.stopsWithComponents(components);
+        if (!stops)
+            return null;
 
-WebInspector.RadialGradient.prototype = {
-    constructor: WebInspector.RadialGradient,
+        return new WebInspector.RadialGradient(sizing, stops);
+    }
+
+    // Public
 
-    copy: function()
+    copy()
     {
         return new WebInspector.RadialGradient(this.sizing, this.stops.concat());
-    },
+    }
 
-    toString: function()
+    toString()
     {
         var str = this.sizing;
 
index 0d9de78..224da01 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabase = function(name, securityOrigin, version, objectStores)
+WebInspector.IndexedDatabase = class IndexedDatabase extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._name = name;
-    this._securityOrigin = securityOrigin;
-    this._host = parseSecurityOrigin(securityOrigin).host;
-    this._version = version;
-    this._objectStores = objectStores || [];
+    constructor(name, securityOrigin, version, objectStores)
+    {
+        super();
 
-    for (var objectStore of this._objectStores)
-        objectStore.establishRelationship(this);
-};
+        this._name = name;
+        this._securityOrigin = securityOrigin;
+        this._host = parseSecurityOrigin(securityOrigin).host;
+        this._version = version;
+        this._objectStores = objectStores || [];
 
-WebInspector.IndexedDatabase.TypeIdentifier = "indexed-database";
-WebInspector.IndexedDatabase.NameCookieKey = "indexed-database-name";
-WebInspector.IndexedDatabase.HostCookieKey = "indexed-database-host";
-
-WebInspector.IndexedDatabase.prototype = {
-    constructor: WebInspector.IndexedDatabase,
-    __proto__: WebInspector.Object.prototype,
+        for (var objectStore of this._objectStores)
+            objectStore.establishRelationship(this);
+    }
 
     // Public
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get securityOrigin()
     {
         return this._securityOrigin;
-    },
+    }
 
     get host()
     {
         return this._host;
-    },
+    }
 
     get version()
     {
         return this._version;
-    },
+    }
 
     get objectStores()
     {
         return this._objectStores;
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.IndexedDatabase.NameCookieKey] = this._name;
         cookie[WebInspector.IndexedDatabase.HostCookieKey] = this._host;
     }
 };
+
+WebInspector.IndexedDatabase.TypeIdentifier = "indexed-database";
+WebInspector.IndexedDatabase.NameCookieKey = "indexed-database-name";
+WebInspector.IndexedDatabase.HostCookieKey = "indexed-database-host";
index 3b633dc..b162d3c 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseObjectStore = function(name, keyPath, autoIncrement, indexes)
+WebInspector.IndexedDatabaseObjectStore = class IndexedDatabaseObjectStore extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._name = name;
-    this._keyPath = keyPath;
-    this._autoIncrement = autoIncrement || false;
-    this._indexes = indexes || [];
-    this._parentDatabase = null;
+    constructor(name, keyPath, autoIncrement, indexes)
+    {
+        super();
 
-    for (var index of this._indexes)
-        index.establishRelationship(this);
-};
+        this._name = name;
+        this._keyPath = keyPath;
+        this._autoIncrement = autoIncrement || false;
+        this._indexes = indexes || [];
+        this._parentDatabase = null;
 
-WebInspector.IndexedDatabaseObjectStore.TypeIdentifier = "indexed-database-object-store";
-WebInspector.IndexedDatabaseObjectStore.NameCookieKey = "indexed-database-object-store-name";
-WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey = "indexed-database-object-store-key-path";
-
-WebInspector.IndexedDatabaseObjectStore.prototype = {
-    constructor: WebInspector.IndexedDatabaseObjectStore,
-    __proto__: WebInspector.Object.prototype,
+        for (var index of this._indexes)
+            index.establishRelationship(this);
+    }
 
     // Public
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get keyPath()
     {
         return this._keyPath;
-    },
+    }
 
     get autoIncrement()
     {
         return this._autoIncrement;
-    },
+    }
 
     get parentDatabase()
     {
         return this._parentDatabase;
-    },
+    }
 
     get indexes()
     {
         return this._indexes;
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.IndexedDatabaseObjectStore.NameCookieKey] = this._name;
         cookie[WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey] = this._keyPath;
-    },
+    }
 
     // Protected
 
-    establishRelationship: function(parentDatabase)
+    establishRelationship(parentDatabase)
     {
         this._parentDatabase = parentDatabase || null;
     }
 };
+
+WebInspector.IndexedDatabaseObjectStore.TypeIdentifier = "indexed-database-object-store";
+WebInspector.IndexedDatabaseObjectStore.NameCookieKey = "indexed-database-object-store-name";
+WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey = "indexed-database-object-store-key-path";
index 3554b5d..f53bdb9 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndexedDatabaseObjectStoreIndex = function(name, keyPath, unique, multiEntry)
+WebInspector.IndexedDatabaseObjectStoreIndex = class IndexedDatabaseObjectStoreIndex extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
-
-    this._name = name;
-    this._keyPath = keyPath;
-    this._unique = unique || false;
-    this._multiEntry = multiEntry || false;
-    this._parentObjectStore = null;
-};
-
-WebInspector.IndexedDatabaseObjectStoreIndex.TypeIdentifier = "indexed-database-object-store-index";
-WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey = "indexed-database-object-store-index-name";
-WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey = "indexed-database-object-store-index-key-path";
+    constructor(name, keyPath, unique, multiEntry)
+    {
+        super();
 
-WebInspector.IndexedDatabaseObjectStoreIndex.prototype = {
-    constructor: WebInspector.IndexedDatabaseObjectStoreIndex,
-    __proto__: WebInspector.Object.prototype,
+        this._name = name;
+        this._keyPath = keyPath;
+        this._unique = unique || false;
+        this._multiEntry = multiEntry || false;
+        this._parentObjectStore = null;
+    }
 
     // Public
 
     get name()
     {
         return this._name;
-    },
+    }
 
     get keyPath()
     {
         return this._keyPath;
-    },
+    }
 
     get unique()
     {
         return this._unique;
-    },
+    }
 
     get multiEntry()
     {
         return this._multiEntry;
-    },
+    }
 
     get parentObjectStore()
     {
         return this._parentObjectStore;
-    },
+    }
 
-    saveIdentityToCookie: function(cookie)
+    saveIdentityToCookie(cookie)
     {
         cookie[WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey] = this._name;
         cookie[WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey] = this._keyPath;
-    },
+    }
 
     // Protected
 
-    establishRelationship: function(parentObjectStore)
+    establishRelationship(parentObjectStore)
     {
         this._parentObjectStore = parentObjectStore || null;
     }
 };
+
+WebInspector.IndexedDatabaseObjectStoreIndex.TypeIdentifier = "indexed-database-object-store-index";
+WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey = "indexed-database-object-store-index-name";
+WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey = "indexed-database-object-store-index-key-path";
index 8e3eb86..3cd43d8 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IssueMessage = function(source, level, text, url, lineNumber, columnNumber, parameters)
+WebInspector.IssueMessage = class IssueMessage extends WebInspector.Object
 {
-    WebInspector.Object.call(this);
+    constructor(source, level, text, url, lineNumber, columnNumber, parameters)
+    {
+        super();
 
-    this._level = level;
-    this._text = text;
+        this._level = level;
+        this._text = text;
 
-    // FIXME: Move to a SourceCodeLocation.
+        // FIXME: Move to a SourceCodeLocation.
 
-    // FIXME <http://webkit.org/b/76404>: Remove the string equality checks for undefined
-    // once we don't get that value anymore from WebCore.
+        // FIXME <http://webkit.org/b/76404>: Remove the string equality checks for undefined
+        // once we don't get that value anymore from WebCore.
 
-    // FIXME: If the URL is undefined, get the URL from the stacktrace.
-    if (url && url !== "undefined")
-        this._url = url;
+        // FIXME: If the URL is undefined, get the URL from the stacktrace.
+        if (url && url !== "undefined")
+            this._url = url;
 
-    if (typeof lineNumber === "number" && lineNumber >= 0)
-        this._lineNumber = lineNumber;
+        if (typeof lineNumber === "number" && lineNumber >= 0)
+            this._lineNumber = lineNumber;
 
-    if (typeof columnNumber === "number" && columnNumber >= 0)
-        this._columnNumber = columnNumber;
+        if (typeof columnNumber === "number" && columnNumber >= 0)
+            this._columnNumber = columnNumber;
 
-    // FIXME: <https://webkit.org/b/142553> Web Inspector: Merge IssueMessage/ConsoleMessage - both attempt to modify the Console Messages parameter independently
+        // FIXME: <https://webkit.org/b/142553> Web Inspector: Merge IssueMessage/ConsoleMessage - both attempt to modify the Console Messages parameter independently
 
-    if (parameters && parameters !== "undefined") {
-        this._parameters = [];
-        for (var i = 0; i < parameters.length; ++i) {
-            if (parameters[i] instanceof WebInspector.RemoteObject) {
-                this._parameters.push(parameters[i]);
-                continue;
-            }
+        if (parameters && parameters !== "undefined") {
+            this._parameters = [];
+            for (var i = 0; i < parameters.length; ++i) {
+                if (parameters[i] instanceof WebInspector.RemoteObject) {
+                    this._parameters.push(parameters[i]);
+                    continue;
+                }
 
-            if (typeof parameters[i] === "object")
-                this._parameters.push(WebInspector.RemoteObject.fromPayload(parameters[i]));
-            else
-                this._parameters.push(WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]));
+                if (typeof parameters[i] === "object")
+                    this._parameters.push(WebInspector.RemoteObject.fromPayload(parameters[i]));
+                else
+                    this._parameters.push(WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]));
+            }
         }
-    }
 
-    this._formatTextIfNecessary();
-
-    switch (source) {
-    case "javascript":
-        // FIXME: It would be nice if we had this information (the specific type of JavaScript error)
-        // as part of the data passed from WebCore, instead of having to determine it ourselves.
-        var prefixRegex = /^([^:]+): (?:DOM Exception \d+: )?/;
-        var match = prefixRegex.exec(this._text);
-        if (match && match[1] in WebInspector.IssueMessage.Type._prefixTypeMap) {
-            this._type = WebInspector.IssueMessage.Type._prefixTypeMap[match[1]];
-            this._text = this._text.substring(match[0].length);
-        } else
+        this._formatTextIfNecessary();
+
+        switch (source) {
+        case "javascript":
+            // FIXME: It would be nice if we had this information (the specific type of JavaScript error)
+            // as part of the data passed from WebCore, instead of having to determine it ourselves.
+            var prefixRegex = /^([^:]+): (?:DOM Exception \d+: )?/;
+            var match = prefixRegex.exec(this._text);
+            if (match && match[1] in WebInspector.IssueMessage.Type._prefixTypeMap) {
+                this._type = WebInspector.IssueMessage.Type._prefixTypeMap[match[1]];
+                this._text = this._text.substring(match[0].length);
+            } else
+                this._type = WebInspector.IssueMessage.Type.OtherIssue;
+            break;
+
+        case "html":
+        case "css":
+        case "wml":
+        case "xml":
+            this._type = WebInspector.IssueMessage.Type.PageIssue;
+            break;
+
+        case "network":
+            this._type = WebInspector.IssueMessage.Type.NetworkIssue;
+            break;
+
+        case "console-api":
+        case "other":
             this._type = WebInspector.IssueMessage.Type.OtherIssue;
-        break;
-
-    case "html":
-    case "css":
-    case "wml":
-    case "xml":
-        this._type = WebInspector.IssueMessage.Type.PageIssue;
-        break;
-
-    case "network":
-        this._type = WebInspector.IssueMessage.Type.NetworkIssue;
-        break;
-
-    case "console-api":
-    case "other":
-        this._type = WebInspector.IssueMessage.Type.OtherIssue;
-        break;
-
-    default:
-        console.error("Unknown issue source:", source);
-        this._type = WebInspector.IssueMessage.Type.OtherIssue;
-    }
-};
-
-WebInspector.IssueMessage.Level = {
-    Error: "error",
-    Warning: "warning"
-};
-
-WebInspector.IssueMessage.Type = {
-    SemanticIssue: "issue-message-type-semantic-issue",
-    RangeIssue: "issue-message-type-range-issue",
-    ReferenceIssue: "issue-message-type-reference-issue",
-    TypeIssue: "issue-message-type-type-issue",
-    PageIssue: "issue-message-type-page-issue",
-    NetworkIssue: "issue-message-type-network-issue",
-    SecurityIssue: "issue-message-type-security-issue",
-    OtherIssue: "issue-message-type-other-issue"
-};
-
-WebInspector.IssueMessage.Type._prefixTypeMap = {
-    "SyntaxError": WebInspector.IssueMessage.Type.SemanticIssue,
-    "URIError": WebInspector.IssueMessage.Type.SemanticIssue,
-    "EvalError": WebInspector.IssueMessage.Type.SemanticIssue,
-    "INVALID_CHARACTER_ERR": WebInspector.IssueMessage.Type.SemanticIssue,
-    "SYNTAX_ERR": WebInspector.IssueMessage.Type.SemanticIssue,
-
-    "RangeError": WebInspector.IssueMessage.Type.RangeIssue,
-    "INDEX_SIZE_ERR": WebInspector.IssueMessage.Type.RangeIssue,
-    "DOMSTRING_SIZE_ERR": WebInspector.IssueMessage.Type.RangeIssue,
+            break;
 
-    "ReferenceError": WebInspector.IssueMessage.Type.ReferenceIssue,
-    "HIERARCHY_REQUEST_ERR": WebInspector.IssueMessage.Type.ReferenceIssue,
-    "INVALID_STATE_ERR": WebInspector.IssueMessage.Type.ReferenceIssue,
-    "NOT_FOUND_ERR": WebInspector.IssueMessage.Type.ReferenceIssue,
-    "WRONG_DOCUMENT_ERR": WebInspector.IssueMessage.Type.ReferenceIssue,
-
-    "TypeError": WebInspector.IssueMessage.Type.TypeIssue,
-    "INVALID_NODE_TYPE_ERR": WebInspector.IssueMessage.Type.TypeIssue,
-    "TYPE_MISMATCH_ERR": WebInspector.IssueMessage.Type.TypeIssue,
-
-    "SECURITY_ERR": WebInspector.IssueMessage.Type.SecurityIssue,
-
-    "NETWORK_ERR": WebInspector.IssueMessage.Type.NetworkIssue,
+        default:
+            console.error("Unknown issue source:", source);
+            this._type = WebInspector.IssueMessage.Type.OtherIssue;
+        }
+    }
 
-    "ABORT_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "DATA_CLONE_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "INUSE_ATTRIBUTE_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "INVALID_ACCESS_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "INVALID_MODIFICATION_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "NAMESPACE_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "NOT_SUPPORTED_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "NO_DATA_ALLOWED_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "NO_MODIFICATION_ALLOWED_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "QUOTA_EXCEEDED_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "TIMEOUT_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "URL_MISMATCH_ERR": WebInspector.IssueMessage.Type.OtherIssue,
-    "VALIDATION_ERR": WebInspector.IssueMessage.Type.OtherIssue
-};
+  &