Web Inspector: Convert Base and Protocol files to ES6 classes
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Mar 2015 23:37:30 +0000 (23:37 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Mar 2015 23:37:30 +0000 (23:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143106

Reviewed by Joseph Pecoraro.

* UserInterface/Base/EventListener.js:
* UserInterface/Base/EventListenerSet.js:
* UserInterface/Protocol/ApplicationCacheObserver.js:
* UserInterface/Protocol/CSSObserver.js:
* UserInterface/Protocol/ConsoleObserver.js:
* UserInterface/Protocol/DOMObserver.js:
* UserInterface/Protocol/DOMStorageObserver.js:
* UserInterface/Protocol/DatabaseObserver.js:
* UserInterface/Protocol/DebuggerObserver.js:
* UserInterface/Protocol/InspectorBackend.js:
* UserInterface/Protocol/InspectorObserver.js:
* UserInterface/Protocol/LayerTreeObserver.js:
* UserInterface/Protocol/MessageDispatcher.js:
* UserInterface/Protocol/NetworkObserver.js:
* UserInterface/Protocol/PageObserver.js:
* UserInterface/Protocol/RemoteObject.js:
* UserInterface/Protocol/ReplayObserver.js:
* UserInterface/Protocol/RuntimeObserver.js:
* UserInterface/Protocol/TimelineObserver.js:
Converted to ES6 classes where possible.

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

20 files changed:
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/EventListener.js
Source/WebInspectorUI/UserInterface/Base/EventListenerSet.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/InspectorBackend.js
Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js
Source/WebInspectorUI/UserInterface/Protocol/LayerTreeObserver.js
Source/WebInspectorUI/UserInterface/Protocol/MessageDispatcher.js
Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js
Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js
Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
Source/WebInspectorUI/UserInterface/Protocol/ReplayObserver.js
Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js
Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js

index 393e725..f931762 100644 (file)
@@ -1,3 +1,31 @@
+2015-03-26  Timothy Hatcher  <timothy@apple.com>
+
+        Web Inspector: Convert Base and Protocol files to ES6 classes
+        https://bugs.webkit.org/show_bug.cgi?id=143106
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Base/EventListener.js:
+        * UserInterface/Base/EventListenerSet.js:
+        * UserInterface/Protocol/ApplicationCacheObserver.js:
+        * UserInterface/Protocol/CSSObserver.js:
+        * UserInterface/Protocol/ConsoleObserver.js:
+        * UserInterface/Protocol/DOMObserver.js:
+        * UserInterface/Protocol/DOMStorageObserver.js:
+        * UserInterface/Protocol/DatabaseObserver.js:
+        * UserInterface/Protocol/DebuggerObserver.js:
+        * UserInterface/Protocol/InspectorBackend.js:
+        * UserInterface/Protocol/InspectorObserver.js:
+        * UserInterface/Protocol/LayerTreeObserver.js:
+        * UserInterface/Protocol/MessageDispatcher.js:
+        * UserInterface/Protocol/NetworkObserver.js:
+        * UserInterface/Protocol/PageObserver.js:
+        * UserInterface/Protocol/RemoteObject.js:
+        * UserInterface/Protocol/ReplayObserver.js:
+        * UserInterface/Protocol/RuntimeObserver.js:
+        * UserInterface/Protocol/TimelineObserver.js:
+        Converted to ES6 classes where possible.
+
 2015-03-25  Tobias Reiss  <tobi+webkit@basecode.de>
 
         Web Inspector: Add ESLint "Disallow Undeclared Variables" rule and enable ES6 env
index 10f1754..0bcb099 100644 (file)
@@ -1,6 +1,6 @@
 /*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2013, 2014 University of Washington. All rights reserved.
- * Copyright (C) 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.EventListener = function(thisObject, fireOnce)
+WebInspector.EventListener = class EventListener
 {
-    this._thisObject = thisObject;
-    this._emitter = null;
-    this._callback = null;
-    this._fireOnce = fireOnce;
-};
+    constructor(thisObject, fireOnce)
+    {
+        this._thisObject = thisObject;
+        this._emitter = null;
+        this._callback = null;
+        this._fireOnce = fireOnce;
+    }
 
-WebInspector.EventListener.prototype = {
-    connect: function(emitter, type, callback, usesCapture)
+    // Public
+
+    connect(emitter, type, callback, usesCapture)
     {
         console.assert(!this._emitter && !this._callback, "EventListener already bound to a callback.", this);
         console.assert(callback, "Missing callback for event: " + type);
@@ -64,9 +67,9 @@ WebInspector.EventListener.prototype = {
             this._emitter.addEventListener(this._type, this._callback, this._usesCapture);
         else
             this._emitter.addEventListener(this._type, this._callback, this._thisObject);
-    },
+    }
 
-    disconnect: function()
+    disconnect()
     {
         console.assert(this._emitter && this._callback, "EventListener is not bound to a callback.", this);
 
index 40d2cdd..aa4f50b 100644 (file)
@@ -1,6 +1,6 @@
 /*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2013, 2014 University of Washington. All rights reserved.
- * Copyright (C) 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 // Add DOM or Inspector event listeners to the set using `register()`.
 // Use `install()` and `uninstall()` to enable or disable all listeners
 // in the set at once.
-WebInspector.EventListenerSet = function(defaultThisObject, name)
+
+WebInspector.EventListenerSet = class EventListenerSet
 {
-    this.name = name;
-    this._defaultThisObject = defaultThisObject;
+    constructor(defaultThisObject, name)
+    {
+        this.name = name;
+        this._defaultThisObject = defaultThisObject;
+
+        this._listeners = [];
+        this._installed = false;
+    }
 
-    this._listeners = [];
-    this._installed = false;
-}
+    // Public
 
-WebInspector.EventListenerSet.prototype = {
-    register: function(emitter, type, callback, thisObject, usesCapture)
+    register(emitter, type, callback, thisObject, usesCapture)
     {
         console.assert(callback, "Missing callback for event: " + type);
         console.assert(type, "Tried to register listener for unknown event: " + type);
@@ -49,16 +53,16 @@ WebInspector.EventListenerSet.prototype = {
             return;
 
         this._listeners.push({listener: new WebInspector.EventListener(thisObject || this._defaultThisObject), emitter, type, callback, usesCapture});
-    },
+    }
 
-    unregister: function()
+    unregister()
     {
         if (this._installed)
             this.uninstall();
         this._listeners = [];
-    },
+    }
 
-    install: function()
+    install()
     {
         console.assert(!this._installed, "Already installed listener group: " + this.name);
         if (this._installed)
@@ -68,9 +72,9 @@ WebInspector.EventListenerSet.prototype = {
 
         for (var data of this._listeners)
             data.listener.connect(data.emitter, data.type, data.callback, data.usesCapture);
-    },
+    }
 
-    uninstall: function(unregisterListeners)
+    uninstall(unregisterListeners)
     {
         console.assert(this._installed, "Trying to uninstall listener group " + this.name + ", but it isn't installed.");
         if (!this._installed)
@@ -83,5 +87,5 @@ WebInspector.EventListenerSet.prototype = {
 
         if (unregisterListeners)
             this._listeners = [];
-    },
-}
+    }
+};
index ede0b70..d803853 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ApplicationCacheObserver = function()
+WebInspector.ApplicationCacheObserver = class ApplicationCacheObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.ApplicationCacheObserver.prototype = {
-    constructor: WebInspector.ApplicationCacheObserver,
-
     // Events defined by the "ApplicationCache" domain.
 
-    applicationCacheStatusUpdated: function(frameId, manifestURL, status)
+    applicationCacheStatusUpdated(frameId, manifestURL, status)
     {
         WebInspector.applicationCacheManager.applicationCacheStatusUpdated(frameId, manifestURL, status);
-    },
+    }
 
-    networkStateUpdated: function(isNowOnline)
+    networkStateUpdated(isNowOnline)
     {
         WebInspector.applicationCacheManager.networkStateUpdated(isNowOnline);
     }
 };
-
-WebInspector.ApplicationCacheObserver.prototype.__proto__ = WebInspector.Object.prototype;
index c094e24..09ac8cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSObserver = function()
+WebInspector.CSSObserver = class CSSObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.CSSObserver.prototype = {
-    constructor: WebInspector.CSSObserver,
-
     // Events defined by the "CSS" domain.
 
-    mediaQueryResultChanged: function()
+    mediaQueryResultChanged()
     {
         WebInspector.cssStyleManager.mediaQueryResultChanged();
-    },
+    }
 
-    styleSheetChanged: function(styleSheetId)
+    styleSheetChanged(styleSheetId)
     {
         WebInspector.cssStyleManager.styleSheetChanged(styleSheetId);
-    },
+    }
 
-    styleSheetAdded: function(header)
+    styleSheetAdded(header)
     {
         // FIXME: Not implemented. <rdar://problem/13213680>
-    },
+    }
 
-    styleSheetRemoved: function(header)
+    styleSheetRemoved(header)
     {
         // FIXME: Not implemented. <rdar://problem/13213680>
-    },
+    }
 
-    namedFlowCreated: function(namedFlow)
+    namedFlowCreated(namedFlow)
     {
         WebInspector.domTreeManager.namedFlowCreated(namedFlow);
-    },
+    }
 
-    namedFlowRemoved: function(documentNodeId, flowName)
+    namedFlowRemoved(documentNodeId, flowName)
     {
         WebInspector.domTreeManager.namedFlowRemoved(documentNodeId, flowName);
-    },
+    }
 
     // COMPATIBILITY (iOS 7): regionLayoutUpdated was removed and replaced by regionOversetChanged.
-    regionLayoutUpdated: function(namedFlow)
+    regionLayoutUpdated(namedFlow)
     {
         WebInspector.domTreeManager.regionLayoutUpdated(namedFlow);
-    },
+    }
 
-    regionOversetChanged: function(namedFlow)
+    regionOversetChanged(namedFlow)
     {
         WebInspector.domTreeManager.regionOversetChanged(namedFlow);
-    },
+    }
 
-    registeredNamedFlowContentElement: function(documentNodeId, flowName, contentNodeId, nextContentElementNodeId)
+    registeredNamedFlowContentElement(documentNodeId, flowName, contentNodeId, nextContentElementNodeId)
     {
         WebInspector.domTreeManager.registeredNamedFlowContentElement(documentNodeId, flowName, contentNodeId, nextContentElementNodeId);
-    },
+    }
 
-    unregisteredNamedFlowContentElement: function(documentNodeId, flowName, contentNodeId)
+    unregisteredNamedFlowContentElement(documentNodeId, flowName, contentNodeId)
     {
         WebInspector.domTreeManager.unregisteredNamedFlowContentElement(documentNodeId, flowName, contentNodeId);
     }
 };
-
-WebInspector.CSSObserver.prototype.__proto__ = WebInspector.Object.prototype;
index 975953e..cfc2fc0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsoleObserver = function()
+WebInspector.ConsoleObserver = class ConsoleObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.ConsoleObserver.prototype = {
-    constructor: WebInspector.ConsoleObserver,
-
     // Events defined by the "Console" domain.
 
-    messageAdded: function(message)
+    messageAdded(message)
     {
         if (message.type === "assert" && !message.text)
             message.text = WebInspector.UIString("Assertion");
@@ -48,17 +41,15 @@ WebInspector.ConsoleObserver.prototype = {
             return;
 
         WebInspector.logManager.messageWasAdded(message.source, message.level, message.text, message.type, message.url, message.line, message.column || 0, message.repeatCount, message.parameters, message.stackTrace, message.networkRequestId);
-    },
+    }
 
-    messageRepeatCountUpdated: function(count)
+    messageRepeatCountUpdated(count)
     {
         WebInspector.logManager.messageRepeatCountUpdated(count);
-    },
+    }
 
-    messagesCleared: function()
+    messagesCleared()
     {
         WebInspector.logManager.messagesCleared();
     }
 };
-
-WebInspector.ConsoleObserver.prototype.__proto__ = WebInspector.Object.prototype;
index 770031f..a0228c9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMObserver = function()
+WebInspector.DOMObserver = class DOMObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.DOMObserver.prototype = {
-    constructor: WebInspector.DOMObserver,
-
     // Events defined by the "DOM" domain.
 
-    documentUpdated: function()
+    documentUpdated()
     {
         WebInspector.domTreeManager._documentUpdated();
-    },
+    }
 
-    setChildNodes: function(parentId, payloads)
+    setChildNodes(parentId, payloads)
     {
         WebInspector.domTreeManager._setChildNodes(parentId, payloads);
-    },
+    }
 
-    attributeModified: function(nodeId, name, value)
+    attributeModified(nodeId, name, value)
     {
         WebInspector.domTreeManager._attributeModified(nodeId, name, value);
-    },
+    }
 
-    attributeRemoved: function(nodeId, name)
+    attributeRemoved(nodeId, name)
     {
         WebInspector.domTreeManager._attributeRemoved(nodeId, name);
-    },
+    }
 
-    inlineStyleInvalidated: function(nodeIds)
+    inlineStyleInvalidated(nodeIds)
     {
         WebInspector.domTreeManager._inlineStyleInvalidated(nodeIds);
-    },
+    }
 
-    characterDataModified: function(nodeId, characterData)
+    characterDataModified(nodeId, characterData)
     {
         WebInspector.domTreeManager._characterDataModified(nodeId, characterData);
-    },
+    }
 
-    childNodeCountUpdated: function(nodeId, childNodeCount)
+    childNodeCountUpdated(nodeId, childNodeCount)
     {
         WebInspector.domTreeManager._childNodeCountUpdated(nodeId, childNodeCount);
-    },
+    }
 
-    childNodeInserted: function(parentNodeId, previousNodeId, payload)
+    childNodeInserted(parentNodeId, previousNodeId, payload)
     {
         WebInspector.domTreeManager._childNodeInserted(parentNodeId, previousNodeId, payload);
-    },
+    }
 
-    childNodeRemoved: function(parentNodeId, nodeId)
+    childNodeRemoved(parentNodeId, nodeId)
     {
         WebInspector.domTreeManager._childNodeRemoved(parentNodeId, nodeId);
-    },
+    }
 
-    shadowRootPushed: function(parentNodeId, nodeId)
+    shadowRootPushed(parentNodeId, nodeId)
     {
         WebInspector.domTreeManager._childNodeInserted(parentNodeId, 0, nodeId);
-    },
+    }
 
-    shadowRootPopped: function(parentNodeId, nodeId)
+    shadowRootPopped(parentNodeId, nodeId)
     {
         WebInspector.domTreeManager._childNodeRemoved(parentNodeId, nodeId);
     }
 };
-
-WebInspector.DOMObserver.prototype.__proto__ = WebInspector.Object.prototype;
index dfe45d5..e6dfdd2 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMStorageObserver = function()
+WebInspector.DOMStorageObserver = class DOMStorageObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.DOMStorageObserver.prototype = {
-    constructor: WebInspector.DOMStorageObserver,
-    __proto__: WebInspector.Object.prototype,
-
     // Events defined by the "DOMStorage" domain.
 
     // COMPATIBILITY (iOS 6): This event no longer exists. It is still needed and called on iOS 6.
-    addDOMStorage: function(storage)
+    addDOMStorage(storage)
     {
         WebInspector.storageManager.domStorageWasAdded(storage.id, storage.host, storage.isLocalStorage);
-    },
+    }
 
     // COMPATIBILITY (iOS 6): This event was split into the granular events below.
-    updateDOMStorage: function(storageId)
+    updateDOMStorage(storageId)
     {
         WebInspector.storageManager.domStorageWasUpdated(storageId);
-    },
+    }
 
-    domStorageItemsCleared: function(storageId)
+    domStorageItemsCleared(storageId)
     {
         WebInspector.storageManager.itemsCleared(storageId);
-    },
+    }
 
-    domStorageItemRemoved: function(storageId, key)
+    domStorageItemRemoved(storageId, key)
     {
         WebInspector.storageManager.itemRemoved(storageId, key);
-    },
+    }
 
-    domStorageItemAdded: function(storageId, key, value)
+    domStorageItemAdded(storageId, key, value)
     {
         WebInspector.storageManager.itemAdded(storageId, key, value);
-    },
+    }
 
-    domStorageItemUpdated: function(storageId, key, oldValue, value)
+    domStorageItemUpdated(storageId, key, oldValue, value)
     {
         WebInspector.storageManager.itemUpdated(storageId, key, oldValue, value);
     }
index 63dbd6f..7b973ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DatabaseObserver = function()
+WebInspector.DatabaseObserver = class DatabaseObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.DatabaseObserver._callbacks = {};
-
-WebInspector.DatabaseObserver.prototype = {
-    constructor: WebInspector.DatabaseObserver,
-
     // Events defined by the "Database" domain.
 
-    addDatabase: function(database)
+    addDatabase(database)
     {
         WebInspector.storageManager.databaseWasAdded(database.id, database.domain, database.name, database.version);
-    },
+    }
 
     // COMPATIBILITY (iOS 6): This event was removed in favor of a more async DatabaseAgent.executeSQL.
-    sqlTransactionSucceeded: function(transactionId, columnNames, values)
+    sqlTransactionSucceeded(transactionId, columnNames, values)
     {
         if (!WebInspector.DatabaseObserver._callbacks[transactionId])
             return;
@@ -52,10 +43,10 @@ WebInspector.DatabaseObserver.prototype = {
 
         if (callback)
             callback(columnNames, values, null);
-    },
+    }
 
     // COMPATIBILITY (iOS 6): This event was removed in favor of a more async DatabaseAgent.executeSQL.
-    sqlTransactionFailed: function(transactionId, sqlError)
+    sqlTransactionFailed(transactionId, sqlError)
     {
         if (!WebInspector.DatabaseObserver._callbacks[transactionId])
             return;
@@ -68,4 +59,4 @@ WebInspector.DatabaseObserver.prototype = {
     }
 };
 
-WebInspector.DatabaseObserver.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.DatabaseObserver._callbacks = {};
index 069e90e..a05c4a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerObserver = function()
+WebInspector.DebuggerObserver = class DebuggerObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.DebuggerObserver.prototype = {
-    constructor: WebInspector.DebuggerObserver,
-
     // Events defined by the "Debugger" domain.
 
-    globalObjectCleared: function()
+    globalObjectCleared()
     {
         WebInspector.debuggerManager.reset();
-    },
+    }
 
-    scriptParsed: function(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL)
+    scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL)
     {
         WebInspector.debuggerManager.scriptDidParse(scriptId, url, isContentScript, startLine, startColumn, endLine, endColumn, sourceMapURL);
-    },
+    }
 
-    scriptFailedToParse: function(url, scriptSource, startLine, errorLine, errorMessage)
+    scriptFailedToParse(url, scriptSource, startLine, errorLine, errorMessage)
     {
         // FIXME: Not implemented.
-    },
+    }
 
-    breakpointResolved: function(breakpointId, location)
+    breakpointResolved(breakpointId, location)
     {
         WebInspector.debuggerManager.breakpointResolved(breakpointId, location);
-    },
+    }
 
-    paused: function(callFrames, reason, data)
+    paused(callFrames, reason, data)
     {
         WebInspector.debuggerManager.debuggerDidPause(callFrames, reason, data);
-    },
+    }
 
-    resumed: function()
+    resumed()
     {
         WebInspector.debuggerManager.debuggerDidResume();
-    },
+    }
 
-    playBreakpointActionSound: function(breakpointActionIdentifier)
+    playBreakpointActionSound(breakpointActionIdentifier)
     {
         WebInspector.debuggerManager.playBreakpointActionSound(breakpointActionIdentifier);
-    },
+    }
 
-    didSampleProbe: function(sample)
+    didSampleProbe(sample)
     {
         WebInspector.probeManager.didSampleProbe(sample);
     }
 };
-
-WebInspector.DebuggerObserver.prototype.__proto__ = WebInspector.Object.prototype;
index 6582f96..e7b807b 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-function InspectorBackendClass()
+InspectorBackendClass = class InspectorBackendClass
 {
-    this._lastSequenceId = 1;
-    this._pendingResponsesCount = 0;
-    this._callbackData = new Map;
-    this._agents = {};
-    this._deferredScripts = [];
-
-    this.dumpInspectorTimeStats = false;
-    this.dumpInspectorProtocolMessages = false;
-    this.warnForLongMessageHandling = false;
-    this.longMessageHandlingThreshold = 10; // milliseconds.
-}
+    constructor()
+    {
+        this._lastSequenceId = 1;
+        this._pendingResponsesCount = 0;
+        this._callbackData = new Map;
+        this._agents = {};
+        this._deferredScripts = [];
 
-InspectorBackendClass.prototype = {
+        this.dumpInspectorTimeStats = false;
+        this.dumpInspectorProtocolMessages = false;
+        this.warnForLongMessageHandling = false;
+        this.longMessageHandlingThreshold = 10; // milliseconds.
+    }
 
     // Public
 
-    registerCommand: function(qualifiedName, callSignature, replySignature)
+    registerCommand(qualifiedName, callSignature, replySignature)
     {
         var [domainName, commandName] = qualifiedName.split(".");
         var agent = this._agentForDomain(domainName);
         agent.addCommand(InspectorBackend.Command.create(this, qualifiedName, callSignature, replySignature));
-    },
+    }
 
-    registerEnum: function(qualifiedName, enumValues)
+    registerEnum(qualifiedName, enumValues)
     {
         var [domainName, enumName] = qualifiedName.split(".");
         var agent = this._agentForDomain(domainName);
         agent.addEnum(enumName, enumValues);
-    },
+    }
 
-    registerEvent: function(qualifiedName, signature)
+    registerEvent(qualifiedName, signature)
     {
         var [domainName, eventName] = qualifiedName.split(".");
         var agent = this._agentForDomain(domainName);
         agent.addEvent(new InspectorBackend.Event(eventName, signature));
-    },
+    }
 
-    registerDomainDispatcher: function(domainName, dispatcher)
+    registerDomainDispatcher(domainName, dispatcher)
     {
         var agent = this._agentForDomain(domainName);
         agent.dispatcher = dispatcher;
-    },
+    }
 
-    dispatch: function(message)
+    dispatch(message)
     {
         if (this.dumpInspectorProtocolMessages)
             console.log("backend: " + ((typeof message === "string") ? message : JSON.stringify(message)));
@@ -86,9 +86,9 @@ InspectorBackendClass.prototype = {
             this._dispatchCallback(messageObject);
         else
             this._dispatchEvent(messageObject);
-    },
+    }
 
-    runAfterPendingDispatches: function(script)
+    runAfterPendingDispatches(script)
     {
         console.assert(script);
         console.assert(typeof script === "function");
@@ -97,9 +97,9 @@ InspectorBackendClass.prototype = {
             script.call(this);
         else
             this._deferredScripts.push(script);
-    },
+    }
 
-    activateDomain: function(domainName, activationDebuggableType)
+    activateDomain(domainName, activationDebuggableType)
     {
         if (!activationDebuggableType || InspectorFrontendHost.debuggableType() === activationDebuggableType) {
             var agent = this._agents[domainName];
@@ -108,11 +108,11 @@ InspectorBackendClass.prototype = {
         }
 
         return null;
-    },
+    }
 
     // Private
 
-    _agentForDomain: function(domainName)
+    _agentForDomain(domainName)
     {
         if (this._agents[domainName])
             return this._agents[domainName];
@@ -120,9 +120,9 @@ InspectorBackendClass.prototype = {
         var agent = new InspectorBackend.Agent(domainName);
         this._agents[domainName] = agent;
         return agent;
-    },
+    }
 
-    _willSendMessageToBackend: function(command, callback)
+    _willSendMessageToBackend(command, callback)
     {
         ++this._pendingResponsesCount;
         var sequenceId = this._lastSequenceId++;
@@ -140,9 +140,9 @@ InspectorBackendClass.prototype = {
         }
 
         return sequenceId;
-    },
+    }
 
-    _dispatchCallback: function(messageObject)
+    _dispatchCallback(messageObject)
     {
         --this._pendingResponsesCount;
         console.assert(this._pendingResponsesCount >= 0);
@@ -195,9 +195,9 @@ InspectorBackendClass.prototype = {
 
         if (this._deferredScripts.length && !this._pendingResponsesCount)
             this._flushPendingScripts();
-    },
+    }
 
-    _dispatchEvent: function(messageObject)
+    _dispatchEvent(messageObject)
     {
         var qualifiedName = messageObject["method"];
         var [domainName, eventName] = qualifiedName.split(".");
@@ -241,9 +241,9 @@ InspectorBackendClass.prototype = {
 
         if (this.dumpInspectorTimeStats)
             console.log("time-stats: Handling: " + processingDuration + "ms (event " + messageObject["method"] + ")");
-    },
+    }
 
-    _invokeCommand: function(command, parameters, callback)
+    _invokeCommand(command, parameters, callback)
     {
         var messageObject = {};
         messageObject["method"] = command.qualifiedName;
@@ -260,14 +260,14 @@ InspectorBackendClass.prototype = {
             console.log("frontend: " + stringifiedMessage);
 
         InspectorFrontendHost.sendMessageToBackend(stringifiedMessage);
-    },
+    }
 
-    _reportProtocolError: function(messageObject)
+    _reportProtocolError(messageObject)
     {
         console.error("Request with id = " + messageObject["id"] + " failed. " + JSON.stringify(messageObject["error"]));
-    },
+    }
 
-    _flushPendingScripts: function()
+    _flushPendingScripts()
     {
         console.assert(!this._pendingResponsesCount);
 
@@ -276,71 +276,74 @@ InspectorBackendClass.prototype = {
         for (var script of scriptsToRun)
             script.call(this);
     }
-}
+};
 
-InspectorBackend = new InspectorBackendClass();
+InspectorBackend = new InspectorBackendClass;
 
-InspectorBackend.Agent = function(domainName)
+InspectorBackend.Agent = class InspectorBackendAgent
 {
-    this._domainName = domainName;
+    constructor(domainName)
+    {
+        this._domainName = domainName;
 
-    // Agents are always created, but are only useable after they are activated.
-    this._active = false;
+        // Agents are always created, but are only useable after they are activated.
+        this._active = false;
+
+        // Commands are stored directly on the Agent instance using their unqualified
+        // method name as the property. Thus, callers can write: FooAgent.methodName().
+        // Enums are stored similarly based on the unqualified type name.
+        this._events = {};
+    }
 
-    // Commands are stored directly on the Agent instance using their unqualified
-    // method name as the property. Thus, callers can write: FooAgent.methodName().
-    // Enums are stored similarly based on the unqualified type name.
-    this._events = {};
-}
+    // Public
 
-InspectorBackend.Agent.prototype = {
     get domainName()
     {
         return this._domainName;
-    },
+    }
 
     get active()
     {
         return this._active;
-    },
+    }
 
     set dispatcher(value)
     {
         this._dispatcher = value;
-    },
+    }
 
-    addEnum: function(enumName, enumValues)
+    addEnum(enumName, enumValues)
     {
         this[enumName] = enumValues;
-    },
+    }
 
-    addCommand: function(command)
+    addCommand(command)
     {
         this[command.commandName] = command;
-    },
+    }
 
-    addEvent: function(event)
+    addEvent(event)
     {
         this._events[event.eventName] = event;
-    },
+    }
 
-    getEvent: function(eventName)
+    getEvent(eventName)
     {
         return this._events[eventName];
-    },
+    }
 
-    hasEvent: function(eventName)
+    hasEvent(eventName)
     {
         return eventName in this._events;
-    },
+    }
 
-    activate: function()
+    activate()
     {
         this._active = true;
         window[this._domainName + "Agent"] = this;
-    },
+    }
 
-    dispatchEvent: function(eventName, eventArguments)
+    dispatchEvent(eventName, eventArguments)
     {
         if (!(eventName in this._dispatcher)) {
             console.error("Protocol Error: Attempted to dispatch an unimplemented method '" + this._domainName + "." + eventName + "'");
@@ -350,10 +353,14 @@ InspectorBackend.Agent.prototype = {
         this._dispatcher[eventName].apply(this._dispatcher, eventArguments);
         return true;
     }
-}
+};
 
+// InspectorBackend.Command can't use ES6 classes because of its trampoline nature.
+// But we can use strict mode to get stricter handling of the code inside its functions.
 InspectorBackend.Command = function(backend, qualifiedName, callSignature, replySignature)
 {
+    'use strict';
+
     this._backend = backend;
     this._instance = this;
 
@@ -362,23 +369,26 @@ InspectorBackend.Command = function(backend, qualifiedName, callSignature, reply
     this._commandName = commandName;
     this._callSignature = callSignature || [];
     this._replySignature = replySignature || [];
-}
+};
 
 InspectorBackend.Command.create = function(backend, commandName, callSignature, replySignature)
 {
+    'use strict';
+
     var instance = new InspectorBackend.Command(backend, commandName, callSignature, replySignature);
 
     function callable() {
         // If the last argument to the command is not a function, return a result promise.
         if (!arguments.length || typeof arguments[arguments.length - 1] !== "function")
             return instance.promise.apply(instance, arguments);
-
         return instance._invokeWithArguments.apply(instance, arguments);
     }
+
     callable._instance = instance;
     callable.__proto__ = InspectorBackend.Command.prototype;
+
     return callable;
-}
+};
 
 // As part of the workaround to make commands callable, these functions use |this._instance|.
 // |this| could refer to the callable trampoline, or the InspectorBackend.Command instance.
@@ -409,18 +419,23 @@ InspectorBackend.Command.prototype = {
 
     invoke: function(commandArguments, callback)
     {
+        'use strict';
+
         var instance = this._instance;
         instance._backend._invokeCommand(instance, commandArguments, callback);
     },
 
     promise: function()
     {
+        'use strict';
+
         var instance = this._instance;
         var promiseArguments = Array.from(arguments);
         return new Promise(function(resolve, reject) {
             function convertToPromiseCallback(error, payload) {
                 return error ? reject(error) : resolve(payload);
             }
+
             // FIXME: this should be indicated by invoking the command differently, rather
             // than by setting a magical property on the callback. <webkit.org/b/132386>
             convertToPromiseCallback.expectsResultObject = true;
@@ -432,6 +447,8 @@ InspectorBackend.Command.prototype = {
 
     supports: function(parameterName)
     {
+        'use strict';
+
         var instance = this._instance;
         return instance.callSignature.some(function(parameter) {
             return parameter["name"] === parameterName;
@@ -442,6 +459,8 @@ InspectorBackend.Command.prototype = {
 
     _invokeWithArguments: function()
     {
+        'use strict';
+
         var instance = this._instance;
         var commandArguments = Array.from(arguments);
         var callback = typeof commandArguments.lastValue === "function" ? commandArguments.pop() : null;
@@ -478,11 +497,14 @@ InspectorBackend.Command.prototype = {
         }
 
         instance._backend._invokeCommand(instance, Object.keys(parameters).length ? parameters : null, callback);
-    },
-}
+    }
+};
 
-InspectorBackend.Event = function(eventName, parameterNames)
+InspectorBackend.Event = class Event
 {
-    this.eventName = eventName;
-    this.parameterNames = parameterNames;
-}
+    constructor(eventName, parameterNames)
+    {
+        this.eventName = eventName;
+        this.parameterNames = parameterNames;
+    }
+};
index 8491757..8bdadb7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.InspectorObserver = function()
+WebInspector.InspectorObserver = class InspectorObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.InspectorObserver.prototype = {
-    constructor: WebInspector.InspectorObserver,
-
     // Events defined by the "Inspector" domain.
 
-    evaluateForTestInFrontend: function(script)
+    evaluateForTestInFrontend(script)
     {
         if (!InspectorFrontendHost.isUnderTest())
             return;
@@ -42,9 +35,9 @@ WebInspector.InspectorObserver.prototype = {
         InspectorBackend.runAfterPendingDispatches(function() {
             window.eval(script);
         });
-    },
+    }
 
-    inspect: function(payload, hints)
+    inspect(payload, hints)
     {
         var remoteObject = WebInspector.RemoteObject.fromPayload(payload);
         if (remoteObject.subtype === "node") {
@@ -61,17 +54,15 @@ WebInspector.InspectorObserver.prototype = {
         WebInspector.navigationSidebar.selectedSidebarPanel = WebInspector.resourceSidebarPanel;
 
         remoteObject.release();
-    },
+    }
 
-    detached: function(reason)
+    detached(reason)
     {
         // FIXME: Not implemented.
-    },
+    }
 
-    activateExtraDomains: function(domains)
+    activateExtraDomains(domains)
     {
         WebInspector.activateExtraDomains(domains);
     }
 };
-
-WebInspector.InspectorObserver.prototype.__proto__ = WebInspector.Object.prototype;
index 55cb90e..0ac671b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OdF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.LayerTreeObserver = function()
+WebInspector.LayerTreeObserver = class LayerTreeObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.LayerTreeObserver.prototype = {
-    constructor: WebInspector.LayerTreeObserver,
-
     // Events defined by the "LayerTree" domain.
 
-    layerTreeDidChange: function()
+    layerTreeDidChange()
     {
         if (WebInspector.layerTreeManager.supported)
             WebInspector.layerTreeManager.layerTreeDidChange();
     }
 };
-
-WebInspector.LayerTreeObserver.prototype.__proto__ = WebInspector.Object.prototype;
index 11c8f67..49acf00 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2014 University of Washington
  *
  * Redistribution and use in source and binary forms, with or without
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.messagesToDispatch = [];
+WebInspector._messagesToDispatch = [];
 
 WebInspector.dispatchNextQueuedMessageFromBackend = function()
 {
-    var startCount = WebInspector.messagesToDispatch.length;
+    var startCount = WebInspector._messagesToDispatch.length;
     var startTime = Date.now();
     var timeLimitPerRunLoop = 10; // milliseconds
 
     var i = 0;
-    for (; i < WebInspector.messagesToDispatch.length; ++i) {
+    for (; i < WebInspector._messagesToDispatch.length; ++i) {
         // Defer remaining messages if we have taken too long. In practice, single
         // messages like Page.getResourceContent blow through the time budget.
         if (Date.now() - startTime > timeLimitPerRunLoop)
             break;
 
-        InspectorBackend.dispatch(WebInspector.messagesToDispatch[i]);
+        InspectorBackend.dispatch(WebInspector._messagesToDispatch[i]);
     }
 
-    if (i === WebInspector.messagesToDispatch.length) {
-        WebInspector.messagesToDispatch = [];
+    if (i === WebInspector._messagesToDispatch.length) {
+        WebInspector._messagesToDispatch = [];
         WebInspector._dispatchTimeout = null;
     } else {
-        WebInspector.messagesToDispatch = WebInspector.messagesToDispatch.slice(i);
+        WebInspector._messagesToDispatch = WebInspector._messagesToDispatch.slice(i);
         WebInspector._dispatchTimeout = setTimeout(WebInspector.dispatchNextQueuedMessageFromBackend, 0);
     }
 
     if (InspectorBackend.dumpInspectorTimeStats)
-        console.log("time-stats: --- RunLoop duration: " + (Date.now() - startTime) + "ms; dispatched: " + (startCount - WebInspector.messagesToDispatch.length) + "; remaining: " + WebInspector.messagesToDispatch.length);
+        console.log("time-stats: --- RunLoop duration: " + (Date.now() - startTime) + "ms; dispatched: " + (startCount - WebInspector._messagesToDispatch.length) + "; remaining: " + WebInspector._messagesToDispatch.length);
 };
 
 WebInspector.dispatchMessageFromBackend = function(message)
@@ -59,7 +59,7 @@ WebInspector.dispatchMessageFromBackend = function(message)
     // Enforce asynchronous interaction between the backend and the frontend by queueing messages.
     // The messages are dequeued on a zero delay timeout.
 
-    this.messagesToDispatch.push(message);
+    WebInspector._messagesToDispatch.push(message);
 
     if (this._dispatchTimeout)
         return;
index 8db90eb..8adcb6e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NetworkObserver = function()
+WebInspector.NetworkObserver = class NetworkObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.NetworkObserver.prototype = {
-    constructor: WebInspector.NetworkObserver,
-
     // Events defined by the "Network" domain.
 
-    requestWillBeSent: function(requestId, frameId, loaderId, documentURL, request, timestamp, initiator, redirectResponse, type)
+    requestWillBeSent(requestId, frameId, loaderId, documentURL, request, timestamp, initiator, redirectResponse, type)
     {
         WebInspector.frameResourceManager.resourceRequestWillBeSent(requestId, frameId, loaderId, request, type, redirectResponse, timestamp, initiator);
-    },
+    }
 
-    requestServedFromCache: function(requestId)
+    requestServedFromCache(requestId)
     {
         WebInspector.frameResourceManager.markResourceRequestAsServedFromMemoryCache(requestId);
-    },
+    }
 
-    responseReceived: function(requestId, frameId, loaderId, timestamp, type, response)
+    responseReceived(requestId, frameId, loaderId, timestamp, type, response)
     {
         WebInspector.frameResourceManager.resourceRequestDidReceiveResponse(requestId, frameId, loaderId, type, response, timestamp);
-    },
+    }
 
-    dataReceived: function(requestId, timestamp, dataLength, encodedDataLength)
+    dataReceived(requestId, timestamp, dataLength, encodedDataLength)
     {
         WebInspector.frameResourceManager.resourceRequestDidReceiveData(requestId, dataLength, encodedDataLength, timestamp);
-    },
+    }
 
-    loadingFinished: function(requestId, timestamp, sourceMapURL)
+    loadingFinished(requestId, timestamp, sourceMapURL)
     {
         WebInspector.frameResourceManager.resourceRequestDidFinishLoading(requestId, timestamp, sourceMapURL);
-    },
+    }
 
-    loadingFailed: function(requestId, timestamp, errorText, canceled)
+    loadingFailed(requestId, timestamp, errorText, canceled)
     {
         WebInspector.frameResourceManager.resourceRequestDidFailLoading(requestId, canceled, timestamp);
-    },
+    }
 
-    requestServedFromMemoryCache: function(requestId, frameId, loaderId, documentURL, timestamp, initiator, resource)
+    requestServedFromMemoryCache(requestId, frameId, loaderId, documentURL, timestamp, initiator, resource)
     {
         WebInspector.frameResourceManager.resourceRequestWasServedFromMemoryCache(requestId, frameId, loaderId, resource, timestamp, initiator);
-    },
+    }
 
-    webSocketWillSendHandshakeRequest: function(requestId, timestamp, request)
+    webSocketWillSendHandshakeRequest(requestId, timestamp, request)
     {
         // FIXME: Not implemented.
-    },
+    }
 
-    webSocketHandshakeResponseReceived: function(requestId, timestamp, response)
+    webSocketHandshakeResponseReceived(requestId, timestamp, response)
     {
         // FIXME: Not implemented.
-    },
+    }
 
-    webSocketCreated: function(requestId, url)
+    webSocketCreated(requestId, url)
     {
         // FIXME: Not implemented.
-    },
+    }
 
-    webSocketClosed: function(requestId, timestamp)
+    webSocketClosed(requestId, timestamp)
     {
         // FIXME: Not implemented.
-    },
+    }
 
-    webSocketFrameReceived: function(requestId, timestamp, response)
+    webSocketFrameReceived(requestId, timestamp, response)
     {
         // FIXME: Not implemented.
-    },
+    }
 
-    webSocketFrameError: function(requestId, timestamp, errorMessage)
+    webSocketFrameError(requestId, timestamp, errorMessage)
     {
         // FIXME: Not implemented.
-    },
+    }
 
-    webSocketFrameSent: function(requestId, timestamp, response)
+    webSocketFrameSent(requestId, timestamp, response)
     {
         // FIXME: Not implemented.
     }
 };
-
-WebInspector.NetworkObserver.prototype.__proto__ = WebInspector.Object.prototype;
index 7bc5d1f..11faeed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.PageObserver = function()
+WebInspector.PageObserver = class PageObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.PageObserver.prototype = {
-    constructor: WebInspector.PageObserver,
-
     // Events defined by the "Page" domain.
 
-    domContentEventFired: function(timestamp)
+    domContentEventFired(timestamp)
     {
         // Covered by Timeline "MarkDOMContent" record.
-    },
+    }
 
-    loadEventFired: function(timestamp)
+    loadEventFired(timestamp)
     {
         WebInspector.timelineManager.pageDidLoad(timestamp);
-    },
+    }
 
-    frameNavigated: function(frame, loaderId)
+    frameNavigated(frame, loaderId)
     {
         WebInspector.frameResourceManager.frameDidNavigate(frame, loaderId);
-    },
+    }
 
-    frameDetached: function(frameId)
+    frameDetached(frameId)
     {
         WebInspector.frameResourceManager.frameDidDetach(frameId);
-    },
+    }
 
-    frameStartedLoading: function(frameId)
+    frameStartedLoading(frameId)
     {
         // Not handled yet.
-    },
+    }
 
-    frameStoppedLoading: function(frameId)
+    frameStoppedLoading(frameId)
     {
         // Not handled yet.
-    },
+    }
 
-    frameScheduledNavigation: function(frameId, delay)
+    frameScheduledNavigation(frameId, delay)
     {
         // Not handled yet.
-    },
+    }
 
-    frameClearedScheduledNavigation: function(frameId)
+    frameClearedScheduledNavigation(frameId)
     {
         // Not handled yet.
-    },
+    }
 
-    javascriptDialogOpening: function(message)
+    javascriptDialogOpening(message)
     {
         // Not handled yet.
-    },
+    }
 
-    javascriptDialogClosed: function()
+    javascriptDialogClosed()
     {
         // Not handled yet.
-    },
+    }
 
-    scriptsEnabled: function(enabled)
+    scriptsEnabled(enabled)
     {
         // Not handled yet.
     }
 };
-
-WebInspector.PageObserver.prototype.__proto__ = WebInspector.Object.prototype;
index d73de75..511a466 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RemoteObject = function(objectId, type, subtype, value, description, size, preview)
+WebInspector.RemoteObject = class RemoteObject
 {
-    // No superclass.
-
-    console.assert(type);
-    console.assert(!preview || preview instanceof WebInspector.ObjectPreview);
-
-    this._type = type;
-    this._subtype = subtype;
-
-    if (objectId) {
-        // Object or Symbol.
-        console.assert(!subtype || typeof subtype === "string");
-        console.assert(!description || typeof description === "string");
-        console.assert(!value);
-
-        this._objectId = objectId;
-        this._description = description;
-        this._hasChildren = type !== "symbol";
-        this._size = size;
-        this._preview = preview;
-    } else {
-        // Primitive or null.
-        console.assert(type !== "object" || value === null);
-        console.assert(!preview);
-
-        this._description = description || (value + "");
-        this._hasChildren = false;
-        this._value = value;
+    constructor(objectId, type, subtype, value, description, size, preview)
+    {
+        console.assert(type);
+        console.assert(!preview || preview instanceof WebInspector.ObjectPreview);
+
+        this._type = type;
+        this._subtype = subtype;
+
+        if (objectId) {
+            // Object or Symbol.
+            console.assert(!subtype || typeof subtype === "string");
+            console.assert(!description || typeof description === "string");
+            console.assert(!value);
+
+            this._objectId = objectId;
+            this._description = description;
+            this._hasChildren = type !== "symbol";
+            this._size = size;
+            this._preview = preview;
+        } else {
+            // Primitive or null.
+            console.assert(type !== "object" || value === null);
+            console.assert(!preview);
+
+            this._description = description || (value + "");
+            this._hasChildren = false;
+            this._value = value;
+        }
     }
-};
 
-WebInspector.RemoteObject.fromPrimitiveValue = function(value)
-{
-    return new WebInspector.RemoteObject(undefined, typeof value, undefined, undefined, value);
-};
+    // Static
 
-WebInspector.RemoteObject.fromPayload = function(payload)
-{
-    console.assert(typeof payload === "object", "Remote object payload should only be an object");
-
-    if (payload.subtype === "array") {
-        // COMPATIBILITY (iOS 8): Runtime.RemoteObject did not have size property,
-        // instead it was tacked onto the end of the description, like "Array[#]".
-        var match = payload.description.match(/\[(\d+)\]$/);
-        if (match) {
-            payload.size = parseInt(match[1]);
-            payload.description = payload.description.replace(/\[\d+\]$/, "");
-        }
+    static fromPrimitiveValue(value)
+    {
+        return new WebInspector.RemoteObject(undefined, typeof value, undefined, undefined, value);
     }
 
-    if (payload.preview) {
-        // COMPATIBILITY (iOS 8): iOS 7 and 8 did not have type/subtype/description on
-        // Runtime.ObjectPreview. Copy them over from the RemoteObject.
-        if (!payload.preview.type) {
-            payload.preview.type = payload.type;
-            payload.preview.subtype = payload.subtype;
-            payload.preview.description = payload.description;
-            payload.preview.size = payload.size;
+    static fromPayload(payload)
+    {
+        console.assert(typeof payload === "object", "Remote object payload should only be an object");
+
+        if (payload.subtype === "array") {
+            // COMPATIBILITY (iOS 8): Runtime.RemoteObject did not have size property,
+            // instead it was tacked onto the end of the description, like "Array[#]".
+            var match = payload.description.match(/\[(\d+)\]$/);
+            if (match) {
+                payload.size = parseInt(match[1]);
+                payload.description = payload.description.replace(/\[\d+\]$/, "");
+            }
         }
-        payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview);
-    }
 
-    return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.preview);
-};
+        if (payload.preview) {
+            // COMPATIBILITY (iOS 8): iOS 7 and 8 did not have type/subtype/description on
+            // Runtime.ObjectPreview. Copy them over from the RemoteObject.
+            if (!payload.preview.type) {
+                payload.preview.type = payload.type;
+                payload.preview.subtype = payload.subtype;
+                payload.preview.description = payload.description;
+                payload.preview.size = payload.size;
+            }
 
-WebInspector.RemoteObject.createCallArgument = function(valueOrObject)
-{
-    if (valueOrObject instanceof WebInspector.RemoteObject) {
-        if (valueOrObject.objectId)
-            return {objectId: valueOrObject.objectId};
-        return {value: valueOrObject.value};
+            payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview);
+        }
+
+        return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.preview);
     }
 
-    return {value: valueOrObject};
-};
+    static createCallArgument(valueOrObject)
+    {
+        if (valueOrObject instanceof WebInspector.RemoteObject) {
+            if (valueOrObject.objectId)
+                return {objectId: valueOrObject.objectId};
+            return {value: valueOrObject.value};
+        }
 
-WebInspector.RemoteObject.resolveNode = function(node, objectGroup, callback)
-{
-    DOMAgent.resolveNode(node.id, objectGroup, function(error, object) {
-        if (!callback)
-            return;
+        return {value: valueOrObject};
+    }
 
-        if (error || !object)
-            callback(null);
-        else
-            callback(WebInspector.RemoteObject.fromPayload(object));
-    });
-};
+    static resolveNode(node, objectGroup, callback)
+    {
+        DOMAgent.resolveNode(node.id, objectGroup, function(error, object) {
+            if (!callback)
+                return;
 
-WebInspector.RemoteObject.type = function(remoteObject)
-{
-    if (remoteObject === null)
-        return "null";
+            if (error || !object)
+                callback(null);
+            else
+                callback(WebInspector.RemoteObject.fromPayload(object));
+        });
+    }
 
-    var type = typeof remoteObject;
-    if (type !== "object" && type !== "function")
-        return type;
+    static type(remoteObject)
+    {
+        if (remoteObject === null)
+            return "null";
 
-    return remoteObject.type;
-};
+        var type = typeof remoteObject;
+        if (type !== "object" && type !== "function")
+            return type;
 
-WebInspector.RemoteObject.prototype = {
-    constructor: WebInspector.RemoteObject,
+        return remoteObject.type;
+    }
+
+    // Public
 
     get objectId()
     {
         return this._objectId;
-    },
+    }
 
     get type()
     {
         return this._type;
-    },
+    }
 
     get subtype()
     {
         return this._subtype;
-    },
+    }
 
     get description()
     {
         return this._description;
-    },
+    }
 
     get hasChildren()
     {
         return this._hasChildren;
-    },
+    }
 
     get value()
     {
         return this._value;
-    },
+    }
 
     get size()
     {
         return this._size || 0;
-    },
+    }
 
     get preview()
     {
         return this._preview;
-    },
+    }
 
-    hasSize: function()
+    hasSize()
     {
         return this.isArray() || this.isCollectionType();
-    },
+    }
 
-    hasValue: function()
+    hasValue()
     {
         return "_value" in this;
-    },
+    }
 
-    getOwnPropertyDescriptors: function(callback)
+    getOwnPropertyDescriptors(callback)
     {
         this._getPropertyDescriptors(true, callback);
-    },
+    }
 
-    getAllPropertyDescriptors: function(callback)
+    getAllPropertyDescriptors(callback)
     {
         this._getPropertyDescriptors(false, callback);
-    },
+    }
 
-    getDisplayablePropertyDescriptors: function(callback)
+    getDisplayablePropertyDescriptors(callback)
     {
         if (!this._objectId || this._isSymbol()) {
             callback([]);
@@ -220,68 +223,27 @@ WebInspector.RemoteObject.prototype = {
                         }
                     }
                 }
+
                 this._getPropertyDescriptorsResolver(callback, error, ownOrGetterPropertiesList);
             }.bind(this));
             return;
         }
 
         RuntimeAgent.getDisplayableProperties(this._objectId, true, this._getPropertyDescriptorsResolver.bind(this, callback));
-    },
-
-    _getPropertyDescriptors: function(ownProperties, callback)
-    {
-        if (!this._objectId || this._isSymbol()) {
-            callback([]);
-            return;
-        }
-
-
-        RuntimeAgent.getProperties(this._objectId, ownProperties, true, this._getPropertyDescriptorsResolver.bind(this, callback));
-    },
-
-    _getPropertyDescriptorsResolver: function(callback, error, properties, internalProperties)
-    {
-        if (error) {
-            callback(null);
-            return;
-        }
-
-        var descriptors = properties.map(function(payload) {
-            return WebInspector.PropertyDescriptor.fromPayload(payload);
-        });
-
-        if (internalProperties) {
-            descriptors = descriptors.concat(internalProperties.map(function(payload) {
-                return WebInspector.PropertyDescriptor.fromPayload(payload, true);
-            }));
-        }
-
-        callback(descriptors);
-    },
-
-    // FIXME: Phase out these functions. They return RemoteObjectProperty instead of PropertyDescriptors.
+    }
 
-    deprecatedGetOwnProperties: function(callback)
+    // FIXME: Phase out these deprecated functions. They return DeprecatedRemoteObjectProperty instead of PropertyDescriptors.
+    deprecatedGetOwnProperties(callback)
     {
         this._deprecatedGetProperties(true, callback);
-    },
+    }
 
-    deprecatedGetAllProperties: function(callback)
+    deprecatedGetAllProperties(callback)
     {
         this._deprecatedGetProperties(false, callback);
-    },
-
-    _deprecatedGetProperties: function(ownProperties, callback)
-    {
-        if (!this._objectId || this._isSymbol()) {
-            callback([]);
-            return;
-        }
-
-        RuntimeAgent.getProperties(this._objectId, ownProperties, this._deprecatedGetPropertiesResolver.bind(this, callback));
-    },
+    }
 
-    deprecatedGetDisplayableProperties: function(callback)
+    deprecatedGetDisplayableProperties(callback)
     {
         if (!this._objectId || this._isSymbol()) {
             callback([]);
@@ -307,46 +269,16 @@ WebInspector.RemoteObject.prototype = {
                         }
                     }
                 }
+
                 this._deprecatedGetPropertiesResolver(callback, error, ownOrGetterPropertiesList);
             }.bind(this));
             return;
         }
 
         RuntimeAgent.getDisplayableProperties(this._objectId, this._deprecatedGetPropertiesResolver.bind(this, callback));
-    },
-
-    _deprecatedGetPropertiesResolver: function(callback, error, properties, internalProperties)
-    {
-        if (error) {
-            callback(null);
-            return;
-        }
-
-        if (internalProperties) {
-            properties = properties.concat(internalProperties.map(function(descriptor) {
-                descriptor.writable = false;
-                descriptor.configurable = false;
-                descriptor.enumerable = false;
-                descriptor.isOwn = true;
-                return descriptor;
-            }));
-        }
-
-        var result = [];
-        for (var i = 0; properties && i < properties.length; ++i) {
-            var property = properties[i];
-            if (property.get || property.set) {
-                if (property.get)
-                    result.push(new WebInspector.RemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get), property));
-                if (property.set)
-                    result.push(new WebInspector.RemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set), property));
-            } else
-                result.push(new WebInspector.RemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property));
-        }
-        callback(result);
-    },
+    }
 
-    setPropertyValue: function(name, value, callback)
+    setPropertyValue(name, value, callback)
     {
         if (!this._objectId || this._isSymbol()) {
             callback("Can't set a property of non-object.");
@@ -368,7 +300,9 @@ WebInspector.RemoteObject.prototype = {
             }
 
             delete result.description; // Optimize on traffic.
-            RuntimeAgent.callFunctionOn(this._objectId, setPropertyValue.toString(), [{ value:name }, result], true, undefined, propertySetCallback.bind(this));
+
+            RuntimeAgent.callFunctionOn(this._objectId, setPropertyValue.toString(), [{value:name}, result], true, undefined, propertySetCallback.bind(this));
+
             if (result._objectId)
                 RuntimeAgent.releaseObject(result._objectId);
         }
@@ -379,31 +313,27 @@ WebInspector.RemoteObject.prototype = {
                 callback(error || result.description);
                 return;
             }
+
             callback();
         }
-    },
-
-    _isSymbol: function()
-    {
-        return this._type === "symbol";
-    },
+    }
 
-    isArray: function()
+    isArray()
     {
         return this._subtype === "array";
-    },
+    }
 
-    isCollectionType: function()
+    isCollectionType()
     {
         return this._subtype === "map" || this._subtype === "set" || this._subtype === "weakmap";
-    },
+    }
 
-    isWeakCollection: function()
+    isWeakCollection()
     {
         return this._subtype === "weakmap";
-    },
+    }
 
-    getCollectionEntries: function(start, numberToFetch, callback)
+    getCollectionEntries(start, numberToFetch, callback)
     {
         start = typeof start === "number" ? start : 0;
         numberToFetch = typeof numberToFetch === "number" ? numberToFetch : 100;
@@ -421,24 +351,24 @@ WebInspector.RemoteObject.prototype = {
             entries = entries.map(function(entry) { return WebInspector.CollectionEntry.fromPayload(entry); });
             callback(entries);
         });
-    },
+    }
 
-    releaseWeakCollectionEntries: function()
+    releaseWeakCollectionEntries()
     {
         console.assert(this.isWeakCollection());
 
         RuntimeAgent.releaseObjectGroup(this._weakCollectionObjectGroup());
-    },
+    }
 
-    pushNodeToFrontend: function(callback)
+    pushNodeToFrontend(callback)
     {
         if (this._objectId)
             WebInspector.domTreeManager.pushNodeToFrontend(this._objectId, callback);
         else
             callback(0);
-    },
+    }
 
-    callFunction: function(functionDeclaration, args, generatePreview, callback)
+    callFunction(functionDeclaration, args, generatePreview, callback)
     {
         function mycallback(error, result, wasThrown)
         {
@@ -450,9 +380,9 @@ WebInspector.RemoteObject.prototype = {
             args = args.map(WebInspector.RemoteObject.createCallArgument);
 
         RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, undefined, generatePreview, mycallback);
-    },
+    }
 
-    callFunctionJSON: function(functionDeclaration, args, callback)
+    callFunctionJSON(functionDeclaration, args, callback)
     {
         function mycallback(error, result, wasThrown)
         {
@@ -460,9 +390,9 @@ WebInspector.RemoteObject.prototype = {
         }
 
         RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, true, mycallback);
-    },
+    }
     
-    invokeGetter: function(getterRemoteObject, callback)
+    invokeGetter(getterRemoteObject, callback)
     {
         console.assert(getterRemoteObject instanceof WebInspector.RemoteObject);
 
@@ -472,41 +402,38 @@ WebInspector.RemoteObject.prototype = {
         }
 
         this.callFunction(backendInvokeGetter, [getterRemoteObject], true, callback);
-    },
+    }
 
-    getOwnPropertyDescriptor: function(propertyName, callback)
+    getOwnPropertyDescriptor(propertyName, callback)
     {
-        if (!RuntimeAgent.getOwnPropertyDescriptor) {
-            function backendGetOwnPropertyDescriptor(propertyName)
-            {
-                return this[propertyName];
-            }
-
-            function wrappedCallback(error, result, wasThrown)
-            {
-                if (error || wasThrown || !(result instanceof WebInspector.RemoteObject)) {
-                    callback(null);
-                    return;
-                }
+        function backendGetOwnPropertyDescriptor(propertyName)
+        {
+            return this[propertyName];
+        }
 
-                var fakeDescriptor = {name: propertyName, value: result, writable: true, configurable: true, enumerable: false};
-                var fakePropertyDescriptor = new WebInspector.PropertyDescriptor(fakeDescriptor, true, false, false, false);
-                callback(fakePropertyDescriptor);
+        function wrappedCallback(error, result, wasThrown)
+        {
+            if (error || wasThrown || !(result instanceof WebInspector.RemoteObject)) {
+                callback(null);
+                return;
             }
 
-            this.callFunction(backendGetOwnPropertyDescriptor, [propertyName], false, wrappedCallback);
+            var fakeDescriptor = {name: propertyName, value: result, writable: true, configurable: true, enumerable: false};
+            var fakePropertyDescriptor = new WebInspector.PropertyDescriptor(fakeDescriptor, true, false, false, false);
+            callback(fakePropertyDescriptor);
         }
 
-        // FIXME: Implement a real getOwnPropertyDescriptor?
-    },
+        // FIXME: Implement a real RuntimeAgent.getOwnPropertyDescriptor?
+        this.callFunction(backendGetOwnPropertyDescriptor, [propertyName], false, wrappedCallback);
+    }
 
-    release: function()
+    release()
     {
         if (this._objectId)
             RuntimeAgent.releaseObject(this._objectId);
-    },
+    }
 
-    arrayLength: function()
+    arrayLength()
     {
         if (this._subtype !== "array")
             return 0;
@@ -516,32 +443,116 @@ WebInspector.RemoteObject.prototype = {
             return 0;
 
         return parseInt(matches[1], 10);
-    },
+    }
 
-    asCallArgument: function()
+    asCallArgument()
     {
         return WebInspector.RemoteObject.createCallArgument(this);
-    },
+    }
 
     // Private
 
-    _weakCollectionObjectGroup: function()
+    _isSymbol()
+    {
+        return this._type === "symbol";
+    }
+
+    _weakCollectionObjectGroup()
     {
         return JSON.stringify(this._objectId) + "-WeakMap";
     }
-};
 
-WebInspector.RemoteObjectProperty = function(name, value, descriptor)
-{
-    this.name = name;
-    this.value = value;
-    this.enumerable = descriptor ? !!descriptor.enumerable : true;
-    this.writable = descriptor ? !!descriptor.writable : true;
-    if (descriptor && descriptor.wasThrown)
-        this.wasThrown = true;
+    _getPropertyDescriptors(ownProperties, callback)
+    {
+        if (!this._objectId || this._isSymbol()) {
+            callback([]);
+            return;
+        }
+
+        RuntimeAgent.getProperties(this._objectId, ownProperties, true, this._getPropertyDescriptorsResolver.bind(this, callback));
+    }
+
+    _getPropertyDescriptorsResolver(callback, error, properties, internalProperties)
+    {
+        if (error) {
+            callback(null);
+            return;
+        }
+
+        var descriptors = properties.map(function(payload) {
+            return WebInspector.PropertyDescriptor.fromPayload(payload);
+        });
+
+        if (internalProperties) {
+            descriptors = descriptors.concat(internalProperties.map(function(payload) {
+                return WebInspector.PropertyDescriptor.fromPayload(payload, true);
+            }));
+        }
+
+        callback(descriptors);
+    }
+
+    // FIXME: Phase out these deprecated functions. They return DeprecatedRemoteObjectProperty instead of PropertyDescriptors.
+    _deprecatedGetProperties(ownProperties, callback)
+    {
+        if (!this._objectId || this._isSymbol()) {
+            callback([]);
+            return;
+        }
+
+        RuntimeAgent.getProperties(this._objectId, ownProperties, this._deprecatedGetPropertiesResolver.bind(this, callback));
+    }
+
+    _deprecatedGetPropertiesResolver(callback, error, properties, internalProperties)
+    {
+        if (error) {
+            callback(null);
+            return;
+        }
+
+        if (internalProperties) {
+            properties = properties.concat(internalProperties.map(function(descriptor) {
+                descriptor.writable = false;
+                descriptor.configurable = false;
+                descriptor.enumerable = false;
+                descriptor.isOwn = true;
+                return descriptor;
+            }));
+        }
+
+        var result = [];
+        for (var i = 0; properties && i < properties.length; ++i) {
+            var property = properties[i];
+            if (property.get || property.set) {
+                if (property.get)
+                    result.push(new WebInspector.DeprecatedRemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get), property));
+                if (property.set)
+                    result.push(new WebInspector.DeprecatedRemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set), property));
+            } else
+                result.push(new WebInspector.DeprecatedRemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property));
+        }
+
+        callback(result);
+    }
 };
 
-WebInspector.RemoteObjectProperty.fromPrimitiveValue = function(name, value)
+// FIXME: Phase out this deprecated class.
+WebInspector.DeprecatedRemoteObjectProperty = class DeprecatedRemoteObjectProperty
 {
-    return new WebInspector.RemoteObjectProperty(name, WebInspector.RemoteObject.fromPrimitiveValue(value));
+    constructor(name, value, descriptor)
+    {
+        this.name = name;
+        this.value = value;
+        this.enumerable = descriptor ? !!descriptor.enumerable : true;
+        this.writable = descriptor ? !!descriptor.writable : true;
+        if (descriptor && descriptor.wasThrown)
+            this.wasThrown = true;
+    }
+
+    // Static
+
+    fromPrimitiveValue(name, value)
+    {
+        return new WebInspector.DeprecatedRemoteObjectProperty(name, WebInspector.RemoteObject.fromPrimitiveValue(value));
+    }
 };
index 2cadc66..e0a8671 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ReplayPosition = function(segmentOffset, inputOffset)
+// FIXME: This ReplayPosition class shouldn't be here, no matter how simple it is.
+WebInspector.ReplayPosition = class ReplayPosition
 {
-    this.segmentOffset = segmentOffset;
-    this.inputOffset = inputOffset;
-};
-
-WebInspector.ReplayPosition.fromProtocol = function(payload)
-{
-    return new WebInspector.ReplayPosition(payload.segmentOffset, payload.inputOffset);
+    constructor(segmentOffset, inputOffset)
+    {
+        this.segmentOffset = segmentOffset;
+        this.inputOffset = inputOffset;
+    }
 };
 
-WebInspector.ReplayObserver = function()
+WebInspector.ReplayObserver = class ReplayObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
+    // Events defined by the "Replay" domain.
 
-WebInspector.ReplayObserver.prototype = {
-    constructor: WebInspector.ReplayObserver,
-    __proto__: WebInspector.Object.prototype,
-
-    captureStarted: function()
+    captureStarted()
     {
         WebInspector.replayManager.captureStarted();
-    },
+    }
 
-    captureStopped: function()
+    captureStopped()
     {
         WebInspector.replayManager.captureStopped();
-    },
+    }
 
-    playbackStarted: function()
+    playbackStarted()
     {
         WebInspector.replayManager.playbackStarted();
-    },
+    }
 
-    playbackHitPosition: function(replayPosition, timestamp)
+    playbackHitPosition(replayPosition, timestamp)
     {
-        WebInspector.replayManager.playbackHitPosition(WebInspector.ReplayPosition.fromProtocol(replayPosition), timestamp);
-    },
+        WebInspector.replayManager.playbackHitPosition(new WebInspector.ReplayPosition(replayPosition.segmentOffset, replayPosition.inputOffset), timestamp);
+    }
 
-    playbackPaused: function(replayPosition)
+    playbackPaused(replayPosition)
     {
-        WebInspector.replayManager.playbackPaused(WebInspector.ReplayPosition.fromProtocol(replayPosition));
-    },
+        WebInspector.replayManager.playbackPaused(new WebInspector.ReplayPosition(replayPosition.segmentOffset, replayPosition.inputOffset));
+    }
 
-    playbackFinished: function()
+    playbackFinished()
     {
         WebInspector.replayManager.playbackFinished();
-    },
+    }
 
-    inputSuppressionChanged: function(willSuppress)
+    inputSuppressionChanged(willSuppress)
     {
         // Not handled yet.
-    },
+    }
 
-    sessionCreated: function(sessionId)
+    sessionCreated(sessionId)
     {
         WebInspector.replayManager.sessionCreated(sessionId);
-    },
+    }
 
-    sessionModified: function(sessionId)
+    sessionModified(sessionId)
     {
         WebInspector.replayManager.sessionModified(sessionId);
-    },
+    }
 
-    sessionRemoved: function(sessionId)
+    sessionRemoved(sessionId)
     {
         WebInspector.replayManager.sessionRemoved(sessionId);
-    },
+    }
 
-    sessionLoaded: function(sessionId)
+    sessionLoaded(sessionId)
     {
         WebInspector.replayManager.sessionLoaded(sessionId);
-    },
+    }
 
-    segmentCreated: function(segmentId)
+    segmentCreated(segmentId)
     {
         WebInspector.replayManager.segmentCreated(segmentId);
-    },
+    }
 
-    segmentRemoved: function(segmentId)
+    segmentRemoved(segmentId)
     {
         WebInspector.replayManager.segmentRemoved(segmentId);
-    },
+    }
 
-    segmentCompleted: function(segmentId)
+    segmentCompleted(segmentId)
     {
         WebInspector.replayManager.segmentCompleted(segmentId);
-    },
+    }
 
-    segmentLoaded: function(segmentId)
+    segmentLoaded(segmentId)
     {
         WebInspector.replayManager.segmentLoaded(segmentId);
-    },
+    }
 
-    segmentUnloaded: function()
+    segmentUnloaded()
     {
         WebInspector.replayManager.segmentUnloaded();
     }
index 969ed24..e09baa4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.RuntimeObserver = function()
+WebInspector.RuntimeObserver = class RuntimeObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.RuntimeObserver.prototype = {
-    constructor: WebInspector.RuntimeObserver,
-
     // Events defined by the "Runtime" domain.
 
-    executionContextCreated: function(contextPayload)
+    executionContextCreated(contextPayload)
     {
         WebInspector.frameResourceManager.executionContextCreated(contextPayload);
     }
 };
-
-WebInspector.RuntimeObserver.prototype.__proto__ = WebInspector.Object.prototype;
index 9514bde..a6ec4b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TimelineObserver = function()
+WebInspector.TimelineObserver = class TimelineObserver
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-};
-
-WebInspector.TimelineObserver.prototype = {
-    constructor: WebInspector.TimelineObserver,
-
     // Events defined by the "Timeline" domain.
 
-    eventRecorded: function(record)
+    eventRecorded(record)
     {
         WebInspector.timelineManager.eventRecorded(record);
-    },
+    }
 
-    recordingStarted: function()
+    recordingStarted()
     {
         WebInspector.timelineManager.capturingStarted();
-    },
+    }
 
-    recordingStopped: function()
+    recordingStopped()
     {
         WebInspector.timelineManager.capturingStopped();
     }
 };
-
-WebInspector.TimelineObserver.prototype.__proto__ = WebInspector.Object.prototype;