Changeset 182039 in webkit
- Timestamp:
- Mar 26, 2015 4:37:30 PM (9 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r181987 r182039 1 2015-03-26 Timothy Hatcher <timothy@apple.com> 2 3 Web Inspector: Convert Base and Protocol files to ES6 classes 4 https://bugs.webkit.org/show_bug.cgi?id=143106 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/Base/EventListener.js: 9 * UserInterface/Base/EventListenerSet.js: 10 * UserInterface/Protocol/ApplicationCacheObserver.js: 11 * UserInterface/Protocol/CSSObserver.js: 12 * UserInterface/Protocol/ConsoleObserver.js: 13 * UserInterface/Protocol/DOMObserver.js: 14 * UserInterface/Protocol/DOMStorageObserver.js: 15 * UserInterface/Protocol/DatabaseObserver.js: 16 * UserInterface/Protocol/DebuggerObserver.js: 17 * UserInterface/Protocol/InspectorBackend.js: 18 * UserInterface/Protocol/InspectorObserver.js: 19 * UserInterface/Protocol/LayerTreeObserver.js: 20 * UserInterface/Protocol/MessageDispatcher.js: 21 * UserInterface/Protocol/NetworkObserver.js: 22 * UserInterface/Protocol/PageObserver.js: 23 * UserInterface/Protocol/RemoteObject.js: 24 * UserInterface/Protocol/ReplayObserver.js: 25 * UserInterface/Protocol/RuntimeObserver.js: 26 * UserInterface/Protocol/TimelineObserver.js: 27 Converted to ES6 classes where possible. 28 1 29 2015-03-25 Tobias Reiss <tobi+webkit@basecode.de> 2 30 -
trunk/Source/WebInspectorUI/UserInterface/Base/EventListener.js
r173431 r182039 1 1 /* 2 * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. 2 3 * Copyright (C) 2013, 2014 University of Washington. All rights reserved. 3 * Copyright (C) 2014 Apple Inc. All rights reserved.4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 25 25 */ 26 26 27 WebInspector.EventListener = function(thisObject, fireOnce)27 WebInspector.EventListener = class EventListener 28 28 { 29 this._thisObject = thisObject; 30 this._emitter = null; 31 this._callback = null; 32 this._fireOnce = fireOnce; 33 }; 29 constructor(thisObject, fireOnce) 30 { 31 this._thisObject = thisObject; 32 this._emitter = null; 33 this._callback = null; 34 this._fireOnce = fireOnce; 35 } 34 36 35 WebInspector.EventListener.prototype = { 36 connect: function(emitter, type, callback, usesCapture) 37 // Public 38 39 connect(emitter, type, callback, usesCapture) 37 40 { 38 41 console.assert(!this._emitter && !this._callback, "EventListener already bound to a callback.", this); … … 65 68 else 66 69 this._emitter.addEventListener(this._type, this._callback, this._thisObject); 67 } ,70 } 68 71 69 disconnect : function()72 disconnect() 70 73 { 71 74 console.assert(this._emitter && this._callback, "EventListener is not bound to a callback.", this); -
trunk/Source/WebInspectorUI/UserInterface/Base/EventListenerSet.js
r181185 r182039 1 1 /* 2 * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. 2 3 * Copyright (C) 2013, 2014 University of Washington. All rights reserved. 3 * Copyright (C) 2014 Apple Inc. All rights reserved.4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 29 29 // Use `install()` and `uninstall()` to enable or disable all listeners 30 30 // in the set at once. 31 WebInspector.EventListenerSet = function(defaultThisObject, name) 31 32 WebInspector.EventListenerSet = class EventListenerSet 32 33 { 33 this.name = name; 34 this._defaultThisObject = defaultThisObject; 34 constructor(defaultThisObject, name) 35 { 36 this.name = name; 37 this._defaultThisObject = defaultThisObject; 35 38 36 this._listeners = [];37 this._installed = false;38 }39 this._listeners = []; 40 this._installed = false; 41 } 39 42 40 WebInspector.EventListenerSet.prototype = { 41 register: function(emitter, type, callback, thisObject, usesCapture) 43 // Public 44 45 register(emitter, type, callback, thisObject, usesCapture) 42 46 { 43 47 console.assert(callback, "Missing callback for event: " + type); … … 50 54 51 55 this._listeners.push({listener: new WebInspector.EventListener(thisObject || this._defaultThisObject), emitter, type, callback, usesCapture}); 52 } ,56 } 53 57 54 unregister : function()58 unregister() 55 59 { 56 60 if (this._installed) 57 61 this.uninstall(); 58 62 this._listeners = []; 59 } ,63 } 60 64 61 install : function()65 install() 62 66 { 63 67 console.assert(!this._installed, "Already installed listener group: " + this.name); … … 69 73 for (var data of this._listeners) 70 74 data.listener.connect(data.emitter, data.type, data.callback, data.usesCapture); 71 } ,75 } 72 76 73 uninstall : function(unregisterListeners)77 uninstall(unregisterListeners) 74 78 { 75 79 console.assert(this._installed, "Trying to uninstall listener group " + this.name + ", but it isn't installed."); … … 84 88 if (unregisterListeners) 85 89 this._listeners = []; 86 } ,87 } 90 } 91 }; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/ApplicationCacheObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.ApplicationCacheObserver = function()26 WebInspector.ApplicationCacheObserver = class ApplicationCacheObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.ApplicationCacheObserver.prototype = {33 constructor: WebInspector.ApplicationCacheObserver,34 35 28 // Events defined by the "ApplicationCache" domain. 36 29 37 applicationCacheStatusUpdated : function(frameId, manifestURL, status)30 applicationCacheStatusUpdated(frameId, manifestURL, status) 38 31 { 39 32 WebInspector.applicationCacheManager.applicationCacheStatusUpdated(frameId, manifestURL, status); 40 } ,33 } 41 34 42 networkStateUpdated : function(isNowOnline)35 networkStateUpdated(isNowOnline) 43 36 { 44 37 WebInspector.applicationCacheManager.networkStateUpdated(isNowOnline); 45 38 } 46 39 }; 47 48 WebInspector.ApplicationCacheObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.CSSObserver = function()26 WebInspector.CSSObserver = class CSSObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.CSSObserver.prototype = {33 constructor: WebInspector.CSSObserver,34 35 28 // Events defined by the "CSS" domain. 36 29 37 mediaQueryResultChanged : function()30 mediaQueryResultChanged() 38 31 { 39 32 WebInspector.cssStyleManager.mediaQueryResultChanged(); 40 } ,33 } 41 34 42 styleSheetChanged : function(styleSheetId)35 styleSheetChanged(styleSheetId) 43 36 { 44 37 WebInspector.cssStyleManager.styleSheetChanged(styleSheetId); 45 } ,38 } 46 39 47 styleSheetAdded : function(header)40 styleSheetAdded(header) 48 41 { 49 42 // FIXME: Not implemented. <rdar://problem/13213680> 50 } ,43 } 51 44 52 styleSheetRemoved : function(header)45 styleSheetRemoved(header) 53 46 { 54 47 // FIXME: Not implemented. <rdar://problem/13213680> 55 } ,48 } 56 49 57 namedFlowCreated : function(namedFlow)50 namedFlowCreated(namedFlow) 58 51 { 59 52 WebInspector.domTreeManager.namedFlowCreated(namedFlow); 60 } ,53 } 61 54 62 namedFlowRemoved : function(documentNodeId, flowName)55 namedFlowRemoved(documentNodeId, flowName) 63 56 { 64 57 WebInspector.domTreeManager.namedFlowRemoved(documentNodeId, flowName); 65 } ,58 } 66 59 67 60 // COMPATIBILITY (iOS 7): regionLayoutUpdated was removed and replaced by regionOversetChanged. 68 regionLayoutUpdated : function(namedFlow)61 regionLayoutUpdated(namedFlow) 69 62 { 70 63 WebInspector.domTreeManager.regionLayoutUpdated(namedFlow); 71 } ,64 } 72 65 73 regionOversetChanged : function(namedFlow)66 regionOversetChanged(namedFlow) 74 67 { 75 68 WebInspector.domTreeManager.regionOversetChanged(namedFlow); 76 } ,69 } 77 70 78 registeredNamedFlowContentElement : function(documentNodeId, flowName, contentNodeId, nextContentElementNodeId)71 registeredNamedFlowContentElement(documentNodeId, flowName, contentNodeId, nextContentElementNodeId) 79 72 { 80 73 WebInspector.domTreeManager.registeredNamedFlowContentElement(documentNodeId, flowName, contentNodeId, nextContentElementNodeId); 81 } ,74 } 82 75 83 unregisteredNamedFlowContentElement : function(documentNodeId, flowName, contentNodeId)76 unregisteredNamedFlowContentElement(documentNodeId, flowName, contentNodeId) 84 77 { 85 78 WebInspector.domTreeManager.unregisteredNamedFlowContentElement(documentNodeId, flowName, contentNodeId); 86 79 } 87 80 }; 88 89 WebInspector.CSSObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.ConsoleObserver = function()26 WebInspector.ConsoleObserver = class ConsoleObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.ConsoleObserver.prototype = {33 constructor: WebInspector.ConsoleObserver,34 35 28 // Events defined by the "Console" domain. 36 29 37 messageAdded : function(message)30 messageAdded(message) 38 31 { 39 32 if (message.type === "assert" && !message.text) … … 49 42 50 43 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); 51 } ,44 } 52 45 53 messageRepeatCountUpdated : function(count)46 messageRepeatCountUpdated(count) 54 47 { 55 48 WebInspector.logManager.messageRepeatCountUpdated(count); 56 } ,49 } 57 50 58 messagesCleared : function()51 messagesCleared() 59 52 { 60 53 WebInspector.logManager.messagesCleared(); 61 54 } 62 55 }; 63 64 WebInspector.ConsoleObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/DOMObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.DOMObserver = function()26 WebInspector.DOMObserver = class DOMObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.DOMObserver.prototype = {33 constructor: WebInspector.DOMObserver,34 35 28 // Events defined by the "DOM" domain. 36 29 37 documentUpdated : function()30 documentUpdated() 38 31 { 39 32 WebInspector.domTreeManager._documentUpdated(); 40 } ,33 } 41 34 42 setChildNodes : function(parentId, payloads)35 setChildNodes(parentId, payloads) 43 36 { 44 37 WebInspector.domTreeManager._setChildNodes(parentId, payloads); 45 } ,38 } 46 39 47 attributeModified : function(nodeId, name, value)40 attributeModified(nodeId, name, value) 48 41 { 49 42 WebInspector.domTreeManager._attributeModified(nodeId, name, value); 50 } ,43 } 51 44 52 attributeRemoved : function(nodeId, name)45 attributeRemoved(nodeId, name) 53 46 { 54 47 WebInspector.domTreeManager._attributeRemoved(nodeId, name); 55 } ,48 } 56 49 57 inlineStyleInvalidated : function(nodeIds)50 inlineStyleInvalidated(nodeIds) 58 51 { 59 52 WebInspector.domTreeManager._inlineStyleInvalidated(nodeIds); 60 } ,53 } 61 54 62 characterDataModified : function(nodeId, characterData)55 characterDataModified(nodeId, characterData) 63 56 { 64 57 WebInspector.domTreeManager._characterDataModified(nodeId, characterData); 65 } ,58 } 66 59 67 childNodeCountUpdated : function(nodeId, childNodeCount)60 childNodeCountUpdated(nodeId, childNodeCount) 68 61 { 69 62 WebInspector.domTreeManager._childNodeCountUpdated(nodeId, childNodeCount); 70 } ,63 } 71 64 72 childNodeInserted : function(parentNodeId, previousNodeId, payload)65 childNodeInserted(parentNodeId, previousNodeId, payload) 73 66 { 74 67 WebInspector.domTreeManager._childNodeInserted(parentNodeId, previousNodeId, payload); 75 } ,68 } 76 69 77 childNodeRemoved : function(parentNodeId, nodeId)70 childNodeRemoved(parentNodeId, nodeId) 78 71 { 79 72 WebInspector.domTreeManager._childNodeRemoved(parentNodeId, nodeId); 80 } ,73 } 81 74 82 shadowRootPushed : function(parentNodeId, nodeId)75 shadowRootPushed(parentNodeId, nodeId) 83 76 { 84 77 WebInspector.domTreeManager._childNodeInserted(parentNodeId, 0, nodeId); 85 } ,78 } 86 79 87 shadowRootPopped : function(parentNodeId, nodeId)80 shadowRootPopped(parentNodeId, nodeId) 88 81 { 89 82 WebInspector.domTreeManager._childNodeRemoved(parentNodeId, nodeId); 90 83 } 91 84 }; 92 93 WebInspector.DOMObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/DOMStorageObserver.js
r181769 r182039 25 25 */ 26 26 27 WebInspector.DOMStorageObserver = function()27 WebInspector.DOMStorageObserver = class DOMStorageObserver 28 28 { 29 // FIXME: Convert this to a WebInspector.Object subclass, and call super().30 // WebInspector.Object.call(this);31 };32 33 WebInspector.DOMStorageObserver.prototype = {34 constructor: WebInspector.DOMStorageObserver,35 __proto__: WebInspector.Object.prototype,36 37 29 // Events defined by the "DOMStorage" domain. 38 30 39 31 // COMPATIBILITY (iOS 6): This event no longer exists. It is still needed and called on iOS 6. 40 addDOMStorage : function(storage)32 addDOMStorage(storage) 41 33 { 42 34 WebInspector.storageManager.domStorageWasAdded(storage.id, storage.host, storage.isLocalStorage); 43 } ,35 } 44 36 45 37 // COMPATIBILITY (iOS 6): This event was split into the granular events below. 46 updateDOMStorage : function(storageId)38 updateDOMStorage(storageId) 47 39 { 48 40 WebInspector.storageManager.domStorageWasUpdated(storageId); 49 } ,41 } 50 42 51 domStorageItemsCleared : function(storageId)43 domStorageItemsCleared(storageId) 52 44 { 53 45 WebInspector.storageManager.itemsCleared(storageId); 54 } ,46 } 55 47 56 domStorageItemRemoved : function(storageId, key)48 domStorageItemRemoved(storageId, key) 57 49 { 58 50 WebInspector.storageManager.itemRemoved(storageId, key); 59 } ,51 } 60 52 61 domStorageItemAdded : function(storageId, key, value)53 domStorageItemAdded(storageId, key, value) 62 54 { 63 55 WebInspector.storageManager.itemAdded(storageId, key, value); 64 } ,56 } 65 57 66 domStorageItemUpdated : function(storageId, key, oldValue, value)58 domStorageItemUpdated(storageId, key, oldValue, value) 67 59 { 68 60 WebInspector.storageManager.itemUpdated(storageId, key, oldValue, value); -
trunk/Source/WebInspectorUI/UserInterface/Protocol/DatabaseObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.DatabaseObserver = function()26 WebInspector.DatabaseObserver = class DatabaseObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.DatabaseObserver._callbacks = {};33 34 WebInspector.DatabaseObserver.prototype = {35 constructor: WebInspector.DatabaseObserver,36 37 28 // Events defined by the "Database" domain. 38 29 39 addDatabase : function(database)30 addDatabase(database) 40 31 { 41 32 WebInspector.storageManager.databaseWasAdded(database.id, database.domain, database.name, database.version); 42 } ,33 } 43 34 44 35 // COMPATIBILITY (iOS 6): This event was removed in favor of a more async DatabaseAgent.executeSQL. 45 sqlTransactionSucceeded : function(transactionId, columnNames, values)36 sqlTransactionSucceeded(transactionId, columnNames, values) 46 37 { 47 38 if (!WebInspector.DatabaseObserver._callbacks[transactionId]) … … 53 44 if (callback) 54 45 callback(columnNames, values, null); 55 } ,46 } 56 47 57 48 // COMPATIBILITY (iOS 6): This event was removed in favor of a more async DatabaseAgent.executeSQL. 58 sqlTransactionFailed : function(transactionId, sqlError)49 sqlTransactionFailed(transactionId, sqlError) 59 50 { 60 51 if (!WebInspector.DatabaseObserver._callbacks[transactionId]) … … 69 60 }; 70 61 71 WebInspector.DatabaseObserver. prototype.__proto__ = WebInspector.Object.prototype;62 WebInspector.DatabaseObserver._callbacks = {}; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.DebuggerObserver = function()26 WebInspector.DebuggerObserver = class DebuggerObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.DebuggerObserver.prototype = {33 constructor: WebInspector.DebuggerObserver,34 35 28 // Events defined by the "Debugger" domain. 36 29 37 globalObjectCleared : function()30 globalObjectCleared() 38 31 { 39 32 WebInspector.debuggerManager.reset(); 40 } ,33 } 41 34 42 scriptParsed : function(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL)35 scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL) 43 36 { 44 37 WebInspector.debuggerManager.scriptDidParse(scriptId, url, isContentScript, startLine, startColumn, endLine, endColumn, sourceMapURL); 45 } ,38 } 46 39 47 scriptFailedToParse : function(url, scriptSource, startLine, errorLine, errorMessage)40 scriptFailedToParse(url, scriptSource, startLine, errorLine, errorMessage) 48 41 { 49 42 // FIXME: Not implemented. 50 } ,43 } 51 44 52 breakpointResolved : function(breakpointId, location)45 breakpointResolved(breakpointId, location) 53 46 { 54 47 WebInspector.debuggerManager.breakpointResolved(breakpointId, location); 55 } ,48 } 56 49 57 paused : function(callFrames, reason, data)50 paused(callFrames, reason, data) 58 51 { 59 52 WebInspector.debuggerManager.debuggerDidPause(callFrames, reason, data); 60 } ,53 } 61 54 62 resumed : function()55 resumed() 63 56 { 64 57 WebInspector.debuggerManager.debuggerDidResume(); 65 } ,58 } 66 59 67 playBreakpointActionSound : function(breakpointActionIdentifier)60 playBreakpointActionSound(breakpointActionIdentifier) 68 61 { 69 62 WebInspector.debuggerManager.playBreakpointActionSound(breakpointActionIdentifier); 70 } ,63 } 71 64 72 didSampleProbe : function(sample)65 didSampleProbe(sample) 73 66 { 74 67 WebInspector.probeManager.didSampleProbe(sample); 75 68 } 76 69 }; 77 78 WebInspector.DebuggerObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js
r180384 r182039 31 31 */ 32 32 33 function InspectorBackendClass() 33 InspectorBackendClass = class InspectorBackendClass 34 34 { 35 this._lastSequenceId = 1;36 this._pendingResponsesCount = 0;37 this._callbackData = new Map;38 this._agents = {};39 this._deferredScripts = [];40 41 this.dumpInspectorTimeStats = false;42 this.dumpInspectorProtocolMessages = false; 43 this.warnForLongMessageHandling= false;44 this.longMessageHandlingThreshold = 10; // milliseconds.45 } 46 47 InspectorBackendClass.prototype = { 35 constructor() 36 { 37 this._lastSequenceId = 1; 38 this._pendingResponsesCount = 0; 39 this._callbackData = new Map; 40 this._agents = {}; 41 this._deferredScripts = []; 42 43 this.dumpInspectorTimeStats = false; 44 this.dumpInspectorProtocolMessages = false; 45 this.warnForLongMessageHandling = false; 46 this.longMessageHandlingThreshold = 10; // milliseconds. 47 } 48 48 49 49 // Public 50 50 51 registerCommand : function(qualifiedName, callSignature, replySignature)51 registerCommand(qualifiedName, callSignature, replySignature) 52 52 { 53 53 var [domainName, commandName] = qualifiedName.split("."); 54 54 var agent = this._agentForDomain(domainName); 55 55 agent.addCommand(InspectorBackend.Command.create(this, qualifiedName, callSignature, replySignature)); 56 } ,57 58 registerEnum : function(qualifiedName, enumValues)56 } 57 58 registerEnum(qualifiedName, enumValues) 59 59 { 60 60 var [domainName, enumName] = qualifiedName.split("."); 61 61 var agent = this._agentForDomain(domainName); 62 62 agent.addEnum(enumName, enumValues); 63 } ,64 65 registerEvent : function(qualifiedName, signature)63 } 64 65 registerEvent(qualifiedName, signature) 66 66 { 67 67 var [domainName, eventName] = qualifiedName.split("."); 68 68 var agent = this._agentForDomain(domainName); 69 69 agent.addEvent(new InspectorBackend.Event(eventName, signature)); 70 } ,71 72 registerDomainDispatcher : function(domainName, dispatcher)70 } 71 72 registerDomainDispatcher(domainName, dispatcher) 73 73 { 74 74 var agent = this._agentForDomain(domainName); 75 75 agent.dispatcher = dispatcher; 76 } ,77 78 dispatch : function(message)76 } 77 78 dispatch(message) 79 79 { 80 80 if (this.dumpInspectorProtocolMessages) … … 87 87 else 88 88 this._dispatchEvent(messageObject); 89 } ,90 91 runAfterPendingDispatches : function(script)89 } 90 91 runAfterPendingDispatches(script) 92 92 { 93 93 console.assert(script); … … 98 98 else 99 99 this._deferredScripts.push(script); 100 } ,101 102 activateDomain : function(domainName, activationDebuggableType)100 } 101 102 activateDomain(domainName, activationDebuggableType) 103 103 { 104 104 if (!activationDebuggableType || InspectorFrontendHost.debuggableType() === activationDebuggableType) { … … 109 109 110 110 return null; 111 } ,111 } 112 112 113 113 // Private 114 114 115 _agentForDomain : function(domainName)115 _agentForDomain(domainName) 116 116 { 117 117 if (this._agents[domainName]) … … 121 121 this._agents[domainName] = agent; 122 122 return agent; 123 } ,124 125 _willSendMessageToBackend : function(command, callback)123 } 124 125 _willSendMessageToBackend(command, callback) 126 126 { 127 127 ++this._pendingResponsesCount; … … 141 141 142 142 return sequenceId; 143 } ,144 145 _dispatchCallback : function(messageObject)143 } 144 145 _dispatchCallback(messageObject) 146 146 { 147 147 --this._pendingResponsesCount; … … 196 196 if (this._deferredScripts.length && !this._pendingResponsesCount) 197 197 this._flushPendingScripts(); 198 } ,199 200 _dispatchEvent : function(messageObject)198 } 199 200 _dispatchEvent(messageObject) 201 201 { 202 202 var qualifiedName = messageObject["method"]; … … 242 242 if (this.dumpInspectorTimeStats) 243 243 console.log("time-stats: Handling: " + processingDuration + "ms (event " + messageObject["method"] + ")"); 244 } ,245 246 _invokeCommand : function(command, parameters, callback)244 } 245 246 _invokeCommand(command, parameters, callback) 247 247 { 248 248 var messageObject = {}; … … 261 261 262 262 InspectorFrontendHost.sendMessageToBackend(stringifiedMessage); 263 } ,264 265 _reportProtocolError : function(messageObject)263 } 264 265 _reportProtocolError(messageObject) 266 266 { 267 267 console.error("Request with id = " + messageObject["id"] + " failed. " + JSON.stringify(messageObject["error"])); 268 } ,269 270 _flushPendingScripts : function()268 } 269 270 _flushPendingScripts() 271 271 { 272 272 console.assert(!this._pendingResponsesCount); … … 277 277 script.call(this); 278 278 } 279 } 280 281 InspectorBackend = new InspectorBackendClass ();282 283 InspectorBackend.Agent = function(domainName)279 }; 280 281 InspectorBackend = new InspectorBackendClass; 282 283 InspectorBackend.Agent = class InspectorBackendAgent 284 284 { 285 this._domainName = domainName; 286 287 // Agents are always created, but are only useable after they are activated. 288 this._active = false; 289 290 // Commands are stored directly on the Agent instance using their unqualified 291 // method name as the property. Thus, callers can write: FooAgent.methodName(). 292 // Enums are stored similarly based on the unqualified type name. 293 this._events = {}; 294 } 295 296 InspectorBackend.Agent.prototype = { 285 constructor(domainName) 286 { 287 this._domainName = domainName; 288 289 // Agents are always created, but are only useable after they are activated. 290 this._active = false; 291 292 // Commands are stored directly on the Agent instance using their unqualified 293 // method name as the property. Thus, callers can write: FooAgent.methodName(). 294 // Enums are stored similarly based on the unqualified type name. 295 this._events = {}; 296 } 297 298 // Public 299 297 300 get domainName() 298 301 { 299 302 return this._domainName; 300 } ,303 } 301 304 302 305 get active() 303 306 { 304 307 return this._active; 305 } ,308 } 306 309 307 310 set dispatcher(value) 308 311 { 309 312 this._dispatcher = value; 310 } ,311 312 addEnum : function(enumName, enumValues)313 } 314 315 addEnum(enumName, enumValues) 313 316 { 314 317 this[enumName] = enumValues; 315 } ,316 317 addCommand : function(command)318 } 319 320 addCommand(command) 318 321 { 319 322 this[command.commandName] = command; 320 } ,321 322 addEvent : function(event)323 } 324 325 addEvent(event) 323 326 { 324 327 this._events[event.eventName] = event; 325 } ,326 327 getEvent : function(eventName)328 } 329 330 getEvent(eventName) 328 331 { 329 332 return this._events[eventName]; 330 } ,331 332 hasEvent : function(eventName)333 } 334 335 hasEvent(eventName) 333 336 { 334 337 return eventName in this._events; 335 } ,336 337 activate : function()338 } 339 340 activate() 338 341 { 339 342 this._active = true; 340 343 window[this._domainName + "Agent"] = this; 341 } ,342 343 dispatchEvent : function(eventName, eventArguments)344 } 345 346 dispatchEvent(eventName, eventArguments) 344 347 { 345 348 if (!(eventName in this._dispatcher)) { … … 351 354 return true; 352 355 } 353 } 354 356 }; 357 358 // InspectorBackend.Command can't use ES6 classes because of its trampoline nature. 359 // But we can use strict mode to get stricter handling of the code inside its functions. 355 360 InspectorBackend.Command = function(backend, qualifiedName, callSignature, replySignature) 356 361 { 362 'use strict'; 363 357 364 this._backend = backend; 358 365 this._instance = this; … … 363 370 this._callSignature = callSignature || []; 364 371 this._replySignature = replySignature || []; 365 } 372 }; 366 373 367 374 InspectorBackend.Command.create = function(backend, commandName, callSignature, replySignature) 368 375 { 376 'use strict'; 377 369 378 var instance = new InspectorBackend.Command(backend, commandName, callSignature, replySignature); 370 379 … … 373 382 if (!arguments.length || typeof arguments[arguments.length - 1] !== "function") 374 383 return instance.promise.apply(instance, arguments); 375 376 384 return instance._invokeWithArguments.apply(instance, arguments); 377 385 } 386 378 387 callable._instance = instance; 379 388 callable.__proto__ = InspectorBackend.Command.prototype; 389 380 390 return callable; 381 } 391 }; 382 392 383 393 // As part of the workaround to make commands callable, these functions use |this._instance|. … … 410 420 invoke: function(commandArguments, callback) 411 421 { 422 'use strict'; 423 412 424 var instance = this._instance; 413 425 instance._backend._invokeCommand(instance, commandArguments, callback); … … 416 428 promise: function() 417 429 { 430 'use strict'; 431 418 432 var instance = this._instance; 419 433 var promiseArguments = Array.from(arguments); … … 422 436 return error ? reject(error) : resolve(payload); 423 437 } 438 424 439 // FIXME: this should be indicated by invoking the command differently, rather 425 440 // than by setting a magical property on the callback. <webkit.org/b/132386> … … 433 448 supports: function(parameterName) 434 449 { 450 'use strict'; 451 435 452 var instance = this._instance; 436 453 return instance.callSignature.some(function(parameter) { … … 443 460 _invokeWithArguments: function() 444 461 { 462 'use strict'; 463 445 464 var instance = this._instance; 446 465 var commandArguments = Array.from(arguments); … … 479 498 480 499 instance._backend._invokeCommand(instance, Object.keys(parameters).length ? parameters : null, callback); 481 } ,482 } 483 484 InspectorBackend.Event = function(eventName, parameterNames)500 } 501 }; 502 503 InspectorBackend.Event = class Event 485 504 { 486 this.eventName = eventName; 487 this.parameterNames = parameterNames; 488 } 505 constructor(eventName, parameterNames) 506 { 507 this.eventName = eventName; 508 this.parameterNames = parameterNames; 509 } 510 }; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 , 2014Apple Inc. All rights reserved.2 * Copyright (C) 2013-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.InspectorObserver = function()26 WebInspector.InspectorObserver = class InspectorObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.InspectorObserver.prototype = {33 constructor: WebInspector.InspectorObserver,34 35 28 // Events defined by the "Inspector" domain. 36 29 37 evaluateForTestInFrontend : function(script)30 evaluateForTestInFrontend(script) 38 31 { 39 32 if (!InspectorFrontendHost.isUnderTest()) … … 43 36 window.eval(script); 44 37 }); 45 } ,38 } 46 39 47 inspect : function(payload, hints)40 inspect(payload, hints) 48 41 { 49 42 var remoteObject = WebInspector.RemoteObject.fromPayload(payload); … … 62 55 63 56 remoteObject.release(); 64 } ,57 } 65 58 66 detached : function(reason)59 detached(reason) 67 60 { 68 61 // FIXME: Not implemented. 69 } ,62 } 70 63 71 activateExtraDomains : function(domains)64 activateExtraDomains(domains) 72 65 { 73 66 WebInspector.activateExtraDomains(domains); 74 67 } 75 68 }; 76 77 WebInspector.InspectorObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/LayerTreeObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 18 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY O F LIABILITY, WHETHER IN20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OdF LIABILITY, WHETHER IN 21 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF … … 24 24 */ 25 25 26 WebInspector.LayerTreeObserver = function()26 WebInspector.LayerTreeObserver = class LayerTreeObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.LayerTreeObserver.prototype = {33 constructor: WebInspector.LayerTreeObserver,34 35 28 // Events defined by the "LayerTree" domain. 36 29 37 layerTreeDidChange : function()30 layerTreeDidChange() 38 31 { 39 32 if (WebInspector.layerTreeManager.supported) … … 41 34 } 42 35 }; 43 44 WebInspector.LayerTreeObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/MessageDispatcher.js
r173431 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2014 University of Washington 4 4 * … … 25 25 */ 26 26 27 WebInspector. messagesToDispatch = [];27 WebInspector._messagesToDispatch = []; 28 28 29 29 WebInspector.dispatchNextQueuedMessageFromBackend = function() 30 30 { 31 var startCount = WebInspector. messagesToDispatch.length;31 var startCount = WebInspector._messagesToDispatch.length; 32 32 var startTime = Date.now(); 33 33 var timeLimitPerRunLoop = 10; // milliseconds 34 34 35 35 var i = 0; 36 for (; i < WebInspector. messagesToDispatch.length; ++i) {36 for (; i < WebInspector._messagesToDispatch.length; ++i) { 37 37 // Defer remaining messages if we have taken too long. In practice, single 38 38 // messages like Page.getResourceContent blow through the time budget. … … 40 40 break; 41 41 42 InspectorBackend.dispatch(WebInspector. messagesToDispatch[i]);42 InspectorBackend.dispatch(WebInspector._messagesToDispatch[i]); 43 43 } 44 44 45 if (i === WebInspector. messagesToDispatch.length) {46 WebInspector. messagesToDispatch = [];45 if (i === WebInspector._messagesToDispatch.length) { 46 WebInspector._messagesToDispatch = []; 47 47 WebInspector._dispatchTimeout = null; 48 48 } else { 49 WebInspector. messagesToDispatch = WebInspector.messagesToDispatch.slice(i);49 WebInspector._messagesToDispatch = WebInspector._messagesToDispatch.slice(i); 50 50 WebInspector._dispatchTimeout = setTimeout(WebInspector.dispatchNextQueuedMessageFromBackend, 0); 51 51 } 52 52 53 53 if (InspectorBackend.dumpInspectorTimeStats) 54 console.log("time-stats: --- RunLoop duration: " + (Date.now() - startTime) + "ms; dispatched: " + (startCount - WebInspector. messagesToDispatch.length) + "; remaining: " + WebInspector.messagesToDispatch.length);54 console.log("time-stats: --- RunLoop duration: " + (Date.now() - startTime) + "ms; dispatched: " + (startCount - WebInspector._messagesToDispatch.length) + "; remaining: " + WebInspector._messagesToDispatch.length); 55 55 }; 56 56 … … 60 60 // The messages are dequeued on a zero delay timeout. 61 61 62 this.messagesToDispatch.push(message);62 WebInspector._messagesToDispatch.push(message); 63 63 64 64 if (this._dispatchTimeout) -
trunk/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.NetworkObserver = function()26 WebInspector.NetworkObserver = class NetworkObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.NetworkObserver.prototype = {33 constructor: WebInspector.NetworkObserver,34 35 28 // Events defined by the "Network" domain. 36 29 37 requestWillBeSent : function(requestId, frameId, loaderId, documentURL, request, timestamp, initiator, redirectResponse, type)30 requestWillBeSent(requestId, frameId, loaderId, documentURL, request, timestamp, initiator, redirectResponse, type) 38 31 { 39 32 WebInspector.frameResourceManager.resourceRequestWillBeSent(requestId, frameId, loaderId, request, type, redirectResponse, timestamp, initiator); 40 } ,33 } 41 34 42 requestServedFromCache : function(requestId)35 requestServedFromCache(requestId) 43 36 { 44 37 WebInspector.frameResourceManager.markResourceRequestAsServedFromMemoryCache(requestId); 45 } ,38 } 46 39 47 responseReceived : function(requestId, frameId, loaderId, timestamp, type, response)40 responseReceived(requestId, frameId, loaderId, timestamp, type, response) 48 41 { 49 42 WebInspector.frameResourceManager.resourceRequestDidReceiveResponse(requestId, frameId, loaderId, type, response, timestamp); 50 } ,43 } 51 44 52 dataReceived : function(requestId, timestamp, dataLength, encodedDataLength)45 dataReceived(requestId, timestamp, dataLength, encodedDataLength) 53 46 { 54 47 WebInspector.frameResourceManager.resourceRequestDidReceiveData(requestId, dataLength, encodedDataLength, timestamp); 55 } ,48 } 56 49 57 loadingFinished : function(requestId, timestamp, sourceMapURL)50 loadingFinished(requestId, timestamp, sourceMapURL) 58 51 { 59 52 WebInspector.frameResourceManager.resourceRequestDidFinishLoading(requestId, timestamp, sourceMapURL); 60 } ,53 } 61 54 62 loadingFailed : function(requestId, timestamp, errorText, canceled)55 loadingFailed(requestId, timestamp, errorText, canceled) 63 56 { 64 57 WebInspector.frameResourceManager.resourceRequestDidFailLoading(requestId, canceled, timestamp); 65 } ,58 } 66 59 67 requestServedFromMemoryCache : function(requestId, frameId, loaderId, documentURL, timestamp, initiator, resource)60 requestServedFromMemoryCache(requestId, frameId, loaderId, documentURL, timestamp, initiator, resource) 68 61 { 69 62 WebInspector.frameResourceManager.resourceRequestWasServedFromMemoryCache(requestId, frameId, loaderId, resource, timestamp, initiator); 70 } ,63 } 71 64 72 webSocketWillSendHandshakeRequest : function(requestId, timestamp, request)65 webSocketWillSendHandshakeRequest(requestId, timestamp, request) 73 66 { 74 67 // FIXME: Not implemented. 75 } ,68 } 76 69 77 webSocketHandshakeResponseReceived : function(requestId, timestamp, response)70 webSocketHandshakeResponseReceived(requestId, timestamp, response) 78 71 { 79 72 // FIXME: Not implemented. 80 } ,73 } 81 74 82 webSocketCreated : function(requestId, url)75 webSocketCreated(requestId, url) 83 76 { 84 77 // FIXME: Not implemented. 85 } ,78 } 86 79 87 webSocketClosed : function(requestId, timestamp)80 webSocketClosed(requestId, timestamp) 88 81 { 89 82 // FIXME: Not implemented. 90 } ,83 } 91 84 92 webSocketFrameReceived : function(requestId, timestamp, response)85 webSocketFrameReceived(requestId, timestamp, response) 93 86 { 94 87 // FIXME: Not implemented. 95 } ,88 } 96 89 97 webSocketFrameError : function(requestId, timestamp, errorMessage)90 webSocketFrameError(requestId, timestamp, errorMessage) 98 91 { 99 92 // FIXME: Not implemented. 100 } ,93 } 101 94 102 webSocketFrameSent : function(requestId, timestamp, response)95 webSocketFrameSent(requestId, timestamp, response) 103 96 { 104 97 // FIXME: Not implemented. 105 98 } 106 99 }; 107 108 WebInspector.NetworkObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.PageObserver = function()26 WebInspector.PageObserver = class PageObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.PageObserver.prototype = {33 constructor: WebInspector.PageObserver,34 35 28 // Events defined by the "Page" domain. 36 29 37 domContentEventFired : function(timestamp)30 domContentEventFired(timestamp) 38 31 { 39 32 // Covered by Timeline "MarkDOMContent" record. 40 } ,33 } 41 34 42 loadEventFired : function(timestamp)35 loadEventFired(timestamp) 43 36 { 44 37 WebInspector.timelineManager.pageDidLoad(timestamp); 45 } ,38 } 46 39 47 frameNavigated : function(frame, loaderId)40 frameNavigated(frame, loaderId) 48 41 { 49 42 WebInspector.frameResourceManager.frameDidNavigate(frame, loaderId); 50 } ,43 } 51 44 52 frameDetached : function(frameId)45 frameDetached(frameId) 53 46 { 54 47 WebInspector.frameResourceManager.frameDidDetach(frameId); 55 } ,48 } 56 49 57 frameStartedLoading : function(frameId)50 frameStartedLoading(frameId) 58 51 { 59 52 // Not handled yet. 60 } ,53 } 61 54 62 frameStoppedLoading : function(frameId)55 frameStoppedLoading(frameId) 63 56 { 64 57 // Not handled yet. 65 } ,58 } 66 59 67 frameScheduledNavigation : function(frameId, delay)60 frameScheduledNavigation(frameId, delay) 68 61 { 69 62 // Not handled yet. 70 } ,63 } 71 64 72 frameClearedScheduledNavigation : function(frameId)65 frameClearedScheduledNavigation(frameId) 73 66 { 74 67 // Not handled yet. 75 } ,68 } 76 69 77 javascriptDialogOpening : function(message)70 javascriptDialogOpening(message) 78 71 { 79 72 // Not handled yet. 80 } ,73 } 81 74 82 javascriptDialogClosed : function()75 javascriptDialogClosed() 83 76 { 84 77 // Not handled yet. 85 } ,78 } 86 79 87 scriptsEnabled : function(enabled)80 scriptsEnabled(enabled) 88 81 { 89 82 // Not handled yet. 90 83 } 91 84 }; 92 93 WebInspector.PageObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
r181930 r182039 1 1 /* 2 2 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 29 30 */ 30 31 31 WebInspector.RemoteObject = function(objectId, type, subtype, value, description, size, preview)32 WebInspector.RemoteObject = class RemoteObject 32 33 { 33 // No superclass. 34 35 console.assert(type); 36 console.assert(!preview || preview instanceof WebInspector.ObjectPreview); 37 38 this._type = type; 39 this._subtype = subtype; 40 41 if (objectId) { 42 // Object or Symbol. 43 console.assert(!subtype || typeof subtype === "string"); 44 console.assert(!description || typeof description === "string"); 45 console.assert(!value); 46 47 this._objectId = objectId; 48 this._description = description; 49 this._hasChildren = type !== "symbol"; 50 this._size = size; 51 this._preview = preview; 52 } else { 53 // Primitive or null. 54 console.assert(type !== "object" || value === null); 55 console.assert(!preview); 56 57 this._description = description || (value + ""); 58 this._hasChildren = false; 59 this._value = value; 60 } 61 }; 62 63 WebInspector.RemoteObject.fromPrimitiveValue = function(value) 64 { 65 return new WebInspector.RemoteObject(undefined, typeof value, undefined, undefined, value); 66 }; 67 68 WebInspector.RemoteObject.fromPayload = function(payload) 69 { 70 console.assert(typeof payload === "object", "Remote object payload should only be an object"); 71 72 if (payload.subtype === "array") { 73 // COMPATIBILITY (iOS 8): Runtime.RemoteObject did not have size property, 74 // instead it was tacked onto the end of the description, like "Array[#]". 75 var match = payload.description.match(/\[(\d+)\]$/); 76 if (match) { 77 payload.size = parseInt(match[1]); 78 payload.description = payload.description.replace(/\[\d+\]$/, ""); 79 } 80 } 81 82 if (payload.preview) { 83 // COMPATIBILITY (iOS 8): iOS 7 and 8 did not have type/subtype/description on 84 // Runtime.ObjectPreview. Copy them over from the RemoteObject. 85 if (!payload.preview.type) { 86 payload.preview.type = payload.type; 87 payload.preview.subtype = payload.subtype; 88 payload.preview.description = payload.description; 89 payload.preview.size = payload.size; 90 } 91 payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview); 92 } 93 94 return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.preview); 95 }; 96 97 WebInspector.RemoteObject.createCallArgument = function(valueOrObject) 98 { 99 if (valueOrObject instanceof WebInspector.RemoteObject) { 100 if (valueOrObject.objectId) 101 return {objectId: valueOrObject.objectId}; 102 return {value: valueOrObject.value}; 103 } 104 105 return {value: valueOrObject}; 106 }; 107 108 WebInspector.RemoteObject.resolveNode = function(node, objectGroup, callback) 109 { 110 DOMAgent.resolveNode(node.id, objectGroup, function(error, object) { 111 if (!callback) 112 return; 113 114 if (error || !object) 115 callback(null); 116 else 117 callback(WebInspector.RemoteObject.fromPayload(object)); 118 }); 119 }; 120 121 WebInspector.RemoteObject.type = function(remoteObject) 122 { 123 if (remoteObject === null) 124 return "null"; 125 126 var type = typeof remoteObject; 127 if (type !== "object" && type !== "function") 128 return type; 129 130 return remoteObject.type; 131 }; 132 133 WebInspector.RemoteObject.prototype = { 134 constructor: WebInspector.RemoteObject, 34 constructor(objectId, type, subtype, value, description, size, preview) 35 { 36 console.assert(type); 37 console.assert(!preview || preview instanceof WebInspector.ObjectPreview); 38 39 this._type = type; 40 this._subtype = subtype; 41 42 if (objectId) { 43 // Object or Symbol. 44 console.assert(!subtype || typeof subtype === "string"); 45 console.assert(!description || typeof description === "string"); 46 console.assert(!value); 47 48 this._objectId = objectId; 49 this._description = description; 50 this._hasChildren = type !== "symbol"; 51 this._size = size; 52 this._preview = preview; 53 } else { 54 // Primitive or null. 55 console.assert(type !== "object" || value === null); 56 console.assert(!preview); 57 58 this._description = description || (value + ""); 59 this._hasChildren = false; 60 this._value = value; 61 } 62 } 63 64 // Static 65 66 static fromPrimitiveValue(value) 67 { 68 return new WebInspector.RemoteObject(undefined, typeof value, undefined, undefined, value); 69 } 70 71 static fromPayload(payload) 72 { 73 console.assert(typeof payload === "object", "Remote object payload should only be an object"); 74 75 if (payload.subtype === "array") { 76 // COMPATIBILITY (iOS 8): Runtime.RemoteObject did not have size property, 77 // instead it was tacked onto the end of the description, like "Array[#]". 78 var match = payload.description.match(/\[(\d+)\]$/); 79 if (match) { 80 payload.size = parseInt(match[1]); 81 payload.description = payload.description.replace(/\[\d+\]$/, ""); 82 } 83 } 84 85 if (payload.preview) { 86 // COMPATIBILITY (iOS 8): iOS 7 and 8 did not have type/subtype/description on 87 // Runtime.ObjectPreview. Copy them over from the RemoteObject. 88 if (!payload.preview.type) { 89 payload.preview.type = payload.type; 90 payload.preview.subtype = payload.subtype; 91 payload.preview.description = payload.description; 92 payload.preview.size = payload.size; 93 } 94 95 payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview); 96 } 97 98 return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.subtype, payload.value, payload.description, payload.size, payload.preview); 99 } 100 101 static createCallArgument(valueOrObject) 102 { 103 if (valueOrObject instanceof WebInspector.RemoteObject) { 104 if (valueOrObject.objectId) 105 return {objectId: valueOrObject.objectId}; 106 return {value: valueOrObject.value}; 107 } 108 109 return {value: valueOrObject}; 110 } 111 112 static resolveNode(node, objectGroup, callback) 113 { 114 DOMAgent.resolveNode(node.id, objectGroup, function(error, object) { 115 if (!callback) 116 return; 117 118 if (error || !object) 119 callback(null); 120 else 121 callback(WebInspector.RemoteObject.fromPayload(object)); 122 }); 123 } 124 125 static type(remoteObject) 126 { 127 if (remoteObject === null) 128 return "null"; 129 130 var type = typeof remoteObject; 131 if (type !== "object" && type !== "function") 132 return type; 133 134 return remoteObject.type; 135 } 136 137 // Public 135 138 136 139 get objectId() 137 140 { 138 141 return this._objectId; 139 } ,142 } 140 143 141 144 get type() 142 145 { 143 146 return this._type; 144 } ,147 } 145 148 146 149 get subtype() 147 150 { 148 151 return this._subtype; 149 } ,152 } 150 153 151 154 get description() 152 155 { 153 156 return this._description; 154 } ,157 } 155 158 156 159 get hasChildren() 157 160 { 158 161 return this._hasChildren; 159 } ,162 } 160 163 161 164 get value() 162 165 { 163 166 return this._value; 164 } ,167 } 165 168 166 169 get size() 167 170 { 168 171 return this._size || 0; 169 } ,172 } 170 173 171 174 get preview() 172 175 { 173 176 return this._preview; 174 } ,175 176 hasSize : function()177 } 178 179 hasSize() 177 180 { 178 181 return this.isArray() || this.isCollectionType(); 179 } ,180 181 hasValue : function()182 } 183 184 hasValue() 182 185 { 183 186 return "_value" in this; 184 } ,185 186 getOwnPropertyDescriptors : function(callback)187 } 188 189 getOwnPropertyDescriptors(callback) 187 190 { 188 191 this._getPropertyDescriptors(true, callback); 189 } ,190 191 getAllPropertyDescriptors : function(callback)192 } 193 194 getAllPropertyDescriptors(callback) 192 195 { 193 196 this._getPropertyDescriptors(false, callback); 194 } ,195 196 getDisplayablePropertyDescriptors : function(callback)197 } 198 199 getDisplayablePropertyDescriptors(callback) 197 200 { 198 201 if (!this._objectId || this._isSymbol()) { … … 221 224 } 222 225 } 226 223 227 this._getPropertyDescriptorsResolver(callback, error, ownOrGetterPropertiesList); 224 228 }.bind(this)); … … 227 231 228 232 RuntimeAgent.getDisplayableProperties(this._objectId, true, this._getPropertyDescriptorsResolver.bind(this, callback)); 229 }, 230 231 _getPropertyDescriptors: function(ownProperties, callback) 232 { 233 if (!this._objectId || this._isSymbol()) { 234 callback([]); 235 return; 236 } 237 238 239 RuntimeAgent.getProperties(this._objectId, ownProperties, true, this._getPropertyDescriptorsResolver.bind(this, callback)); 240 }, 241 242 _getPropertyDescriptorsResolver: function(callback, error, properties, internalProperties) 243 { 244 if (error) { 245 callback(null); 246 return; 247 } 248 249 var descriptors = properties.map(function(payload) { 250 return WebInspector.PropertyDescriptor.fromPayload(payload); 251 }); 252 253 if (internalProperties) { 254 descriptors = descriptors.concat(internalProperties.map(function(payload) { 255 return WebInspector.PropertyDescriptor.fromPayload(payload, true); 256 })); 257 } 258 259 callback(descriptors); 260 }, 261 262 // FIXME: Phase out these functions. They return RemoteObjectProperty instead of PropertyDescriptors. 263 264 deprecatedGetOwnProperties: function(callback) 233 } 234 235 // FIXME: Phase out these deprecated functions. They return DeprecatedRemoteObjectProperty instead of PropertyDescriptors. 236 deprecatedGetOwnProperties(callback) 265 237 { 266 238 this._deprecatedGetProperties(true, callback); 267 } ,268 269 deprecatedGetAllProperties : function(callback)239 } 240 241 deprecatedGetAllProperties(callback) 270 242 { 271 243 this._deprecatedGetProperties(false, callback); 272 }, 273 274 _deprecatedGetProperties: function(ownProperties, callback) 275 { 276 if (!this._objectId || this._isSymbol()) { 277 callback([]); 278 return; 279 } 280 281 RuntimeAgent.getProperties(this._objectId, ownProperties, this._deprecatedGetPropertiesResolver.bind(this, callback)); 282 }, 283 284 deprecatedGetDisplayableProperties: function(callback) 244 } 245 246 deprecatedGetDisplayableProperties(callback) 285 247 { 286 248 if (!this._objectId || this._isSymbol()) { … … 308 270 } 309 271 } 272 310 273 this._deprecatedGetPropertiesResolver(callback, error, ownOrGetterPropertiesList); 311 274 }.bind(this)); … … 314 277 315 278 RuntimeAgent.getDisplayableProperties(this._objectId, this._deprecatedGetPropertiesResolver.bind(this, callback)); 316 }, 317 318 _deprecatedGetPropertiesResolver: function(callback, error, properties, internalProperties) 279 } 280 281 setPropertyValue(name, value, callback) 282 { 283 if (!this._objectId || this._isSymbol()) { 284 callback("Can't set a property of non-object."); 285 return; 286 } 287 288 RuntimeAgent.evaluate.invoke({expression:value, doNotPauseOnExceptionsAndMuteConsole:true}, evaluatedCallback.bind(this)); 289 290 function evaluatedCallback(error, result, wasThrown) 291 { 292 if (error || wasThrown) { 293 callback(error || result.description); 294 return; 295 } 296 297 function setPropertyValue(propertyName, propertyValue) 298 { 299 this[propertyName] = propertyValue; 300 } 301 302 delete result.description; // Optimize on traffic. 303 304 RuntimeAgent.callFunctionOn(this._objectId, setPropertyValue.toString(), [{value:name}, result], true, undefined, propertySetCallback.bind(this)); 305 306 if (result._objectId) 307 RuntimeAgent.releaseObject(result._objectId); 308 } 309 310 function propertySetCallback(error, result, wasThrown) 311 { 312 if (error || wasThrown) { 313 callback(error || result.description); 314 return; 315 } 316 317 callback(); 318 } 319 } 320 321 isArray() 322 { 323 return this._subtype === "array"; 324 } 325 326 isCollectionType() 327 { 328 return this._subtype === "map" || this._subtype === "set" || this._subtype === "weakmap"; 329 } 330 331 isWeakCollection() 332 { 333 return this._subtype === "weakmap"; 334 } 335 336 getCollectionEntries(start, numberToFetch, callback) 337 { 338 start = typeof start === "number" ? start : 0; 339 numberToFetch = typeof numberToFetch === "number" ? numberToFetch : 100; 340 341 console.assert(start >= 0); 342 console.assert(numberToFetch >= 0); 343 console.assert(this.isCollectionType()); 344 345 // WeakMaps are not ordered. We should never send a non-zero start. 346 console.assert((this._subtype === "weakmap" && start === 0) || this._subtype !== "weakmap"); 347 348 var objectGroup = this.isWeakCollection() ? this._weakCollectionObjectGroup() : ""; 349 350 RuntimeAgent.getCollectionEntries(this._objectId, objectGroup, start, numberToFetch, function(error, entries) { 351 entries = entries.map(function(entry) { return WebInspector.CollectionEntry.fromPayload(entry); }); 352 callback(entries); 353 }); 354 } 355 356 releaseWeakCollectionEntries() 357 { 358 console.assert(this.isWeakCollection()); 359 360 RuntimeAgent.releaseObjectGroup(this._weakCollectionObjectGroup()); 361 } 362 363 pushNodeToFrontend(callback) 364 { 365 if (this._objectId) 366 WebInspector.domTreeManager.pushNodeToFrontend(this._objectId, callback); 367 else 368 callback(0); 369 } 370 371 callFunction(functionDeclaration, args, generatePreview, callback) 372 { 373 function mycallback(error, result, wasThrown) 374 { 375 result = result ? WebInspector.RemoteObject.fromPayload(result) : null; 376 callback(error, result, wasThrown); 377 } 378 379 if (args) 380 args = args.map(WebInspector.RemoteObject.createCallArgument); 381 382 RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, undefined, generatePreview, mycallback); 383 } 384 385 callFunctionJSON(functionDeclaration, args, callback) 386 { 387 function mycallback(error, result, wasThrown) 388 { 389 callback((error || wasThrown) ? null : result.value); 390 } 391 392 RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, true, mycallback); 393 } 394 395 invokeGetter(getterRemoteObject, callback) 396 { 397 console.assert(getterRemoteObject instanceof WebInspector.RemoteObject); 398 399 function backendInvokeGetter(getter) 400 { 401 return getter ? getter.call(this) : undefined; 402 } 403 404 this.callFunction(backendInvokeGetter, [getterRemoteObject], true, callback); 405 } 406 407 getOwnPropertyDescriptor(propertyName, callback) 408 { 409 function backendGetOwnPropertyDescriptor(propertyName) 410 { 411 return this[propertyName]; 412 } 413 414 function wrappedCallback(error, result, wasThrown) 415 { 416 if (error || wasThrown || !(result instanceof WebInspector.RemoteObject)) { 417 callback(null); 418 return; 419 } 420 421 var fakeDescriptor = {name: propertyName, value: result, writable: true, configurable: true, enumerable: false}; 422 var fakePropertyDescriptor = new WebInspector.PropertyDescriptor(fakeDescriptor, true, false, false, false); 423 callback(fakePropertyDescriptor); 424 } 425 426 // FIXME: Implement a real RuntimeAgent.getOwnPropertyDescriptor? 427 this.callFunction(backendGetOwnPropertyDescriptor, [propertyName], false, wrappedCallback); 428 } 429 430 release() 431 { 432 if (this._objectId) 433 RuntimeAgent.releaseObject(this._objectId); 434 } 435 436 arrayLength() 437 { 438 if (this._subtype !== "array") 439 return 0; 440 441 var matches = this._description.match(/\[([0-9]+)\]/); 442 if (!matches) 443 return 0; 444 445 return parseInt(matches[1], 10); 446 } 447 448 asCallArgument() 449 { 450 return WebInspector.RemoteObject.createCallArgument(this); 451 } 452 453 // Private 454 455 _isSymbol() 456 { 457 return this._type === "symbol"; 458 } 459 460 _weakCollectionObjectGroup() 461 { 462 return JSON.stringify(this._objectId) + "-WeakMap"; 463 } 464 465 _getPropertyDescriptors(ownProperties, callback) 466 { 467 if (!this._objectId || this._isSymbol()) { 468 callback([]); 469 return; 470 } 471 472 RuntimeAgent.getProperties(this._objectId, ownProperties, true, this._getPropertyDescriptorsResolver.bind(this, callback)); 473 } 474 475 _getPropertyDescriptorsResolver(callback, error, properties, internalProperties) 476 { 477 if (error) { 478 callback(null); 479 return; 480 } 481 482 var descriptors = properties.map(function(payload) { 483 return WebInspector.PropertyDescriptor.fromPayload(payload); 484 }); 485 486 if (internalProperties) { 487 descriptors = descriptors.concat(internalProperties.map(function(payload) { 488 return WebInspector.PropertyDescriptor.fromPayload(payload, true); 489 })); 490 } 491 492 callback(descriptors); 493 } 494 495 // FIXME: Phase out these deprecated functions. They return DeprecatedRemoteObjectProperty instead of PropertyDescriptors. 496 _deprecatedGetProperties(ownProperties, callback) 497 { 498 if (!this._objectId || this._isSymbol()) { 499 callback([]); 500 return; 501 } 502 503 RuntimeAgent.getProperties(this._objectId, ownProperties, this._deprecatedGetPropertiesResolver.bind(this, callback)); 504 } 505 506 _deprecatedGetPropertiesResolver(callback, error, properties, internalProperties) 319 507 { 320 508 if (error) { … … 338 526 if (property.get || property.set) { 339 527 if (property.get) 340 result.push(new WebInspector. RemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get), property));528 result.push(new WebInspector.DeprecatedRemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get), property)); 341 529 if (property.set) 342 result.push(new WebInspector. RemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set), property));530 result.push(new WebInspector.DeprecatedRemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set), property)); 343 531 } else 344 result.push(new WebInspector.RemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property)); 345 } 532 result.push(new WebInspector.DeprecatedRemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property)); 533 } 534 346 535 callback(result); 347 },348 349 setPropertyValue: function(name, value, callback)350 {351 if (!this._objectId || this._isSymbol()) {352 callback("Can't set a property of non-object.");353 return;354 }355 356 RuntimeAgent.evaluate.invoke({expression:value, doNotPauseOnExceptionsAndMuteConsole:true}, evaluatedCallback.bind(this));357 358 function evaluatedCallback(error, result, wasThrown)359 {360 if (error || wasThrown) {361 callback(error || result.description);362 return;363 }364 365 function setPropertyValue(propertyName, propertyValue)366 {367 this[propertyName] = propertyValue;368 }369 370 delete result.description; // Optimize on traffic.371 RuntimeAgent.callFunctionOn(this._objectId, setPropertyValue.toString(), [{ value:name }, result], true, undefined, propertySetCallback.bind(this));372 if (result._objectId)373 RuntimeAgent.releaseObject(result._objectId);374 }375 376 function propertySetCallback(error, result, wasThrown)377 {378 if (error || wasThrown) {379 callback(error || result.description);380 return;381 }382 callback();383 }384 },385 386 _isSymbol: function()387 {388 return this._type === "symbol";389 },390 391 isArray: function()392 {393 return this._subtype === "array";394 },395 396 isCollectionType: function()397 {398 return this._subtype === "map" || this._subtype === "set" || this._subtype === "weakmap";399 },400 401 isWeakCollection: function()402 {403 return this._subtype === "weakmap";404 },405 406 getCollectionEntries: function(start, numberToFetch, callback)407 {408 start = typeof start === "number" ? start : 0;409 numberToFetch = typeof numberToFetch === "number" ? numberToFetch : 100;410 411 console.assert(start >= 0);412 console.assert(numberToFetch >= 0);413 console.assert(this.isCollectionType());414 415 // WeakMaps are not ordered. We should never send a non-zero start.416 console.assert((this._subtype === "weakmap" && start === 0) || this._subtype !== "weakmap");417 418 var objectGroup = this.isWeakCollection() ? this._weakCollectionObjectGroup() : "";419 420 RuntimeAgent.getCollectionEntries(this._objectId, objectGroup, start, numberToFetch, function(error, entries) {421 entries = entries.map(function(entry) { return WebInspector.CollectionEntry.fromPayload(entry); });422 callback(entries);423 });424 },425 426 releaseWeakCollectionEntries: function()427 {428 console.assert(this.isWeakCollection());429 430 RuntimeAgent.releaseObjectGroup(this._weakCollectionObjectGroup());431 },432 433 pushNodeToFrontend: function(callback)434 {435 if (this._objectId)436 WebInspector.domTreeManager.pushNodeToFrontend(this._objectId, callback);437 else438 callback(0);439 },440 441 callFunction: function(functionDeclaration, args, generatePreview, callback)442 {443 function mycallback(error, result, wasThrown)444 {445 result = result ? WebInspector.RemoteObject.fromPayload(result) : null;446 callback(error, result, wasThrown);447 }448 449 if (args)450 args = args.map(WebInspector.RemoteObject.createCallArgument);451 452 RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, undefined, generatePreview, mycallback);453 },454 455 callFunctionJSON: function(functionDeclaration, args, callback)456 {457 function mycallback(error, result, wasThrown)458 {459 callback((error || wasThrown) ? null : result.value);460 }461 462 RuntimeAgent.callFunctionOn(this._objectId, functionDeclaration.toString(), args, true, true, mycallback);463 },464 465 invokeGetter: function(getterRemoteObject, callback)466 {467 console.assert(getterRemoteObject instanceof WebInspector.RemoteObject);468 469 function backendInvokeGetter(getter)470 {471 return getter ? getter.call(this) : undefined;472 }473 474 this.callFunction(backendInvokeGetter, [getterRemoteObject], true, callback);475 },476 477 getOwnPropertyDescriptor: function(propertyName, callback)478 {479 if (!RuntimeAgent.getOwnPropertyDescriptor) {480 function backendGetOwnPropertyDescriptor(propertyName)481 {482 return this[propertyName];483 }484 485 function wrappedCallback(error, result, wasThrown)486 {487 if (error || wasThrown || !(result instanceof WebInspector.RemoteObject)) {488 callback(null);489 return;490 }491 492 var fakeDescriptor = {name: propertyName, value: result, writable: true, configurable: true, enumerable: false};493 var fakePropertyDescriptor = new WebInspector.PropertyDescriptor(fakeDescriptor, true, false, false, false);494 callback(fakePropertyDescriptor);495 }496 497 this.callFunction(backendGetOwnPropertyDescriptor, [propertyName], false, wrappedCallback);498 }499 500 // FIXME: Implement a real getOwnPropertyDescriptor?501 },502 503 release: function()504 {505 if (this._objectId)506 RuntimeAgent.releaseObject(this._objectId);507 },508 509 arrayLength: function()510 {511 if (this._subtype !== "array")512 return 0;513 514 var matches = this._description.match(/\[([0-9]+)\]/);515 if (!matches)516 return 0;517 518 return parseInt(matches[1], 10);519 },520 521 asCallArgument: function()522 {523 return WebInspector.RemoteObject.createCallArgument(this);524 },525 526 // Private527 528 _weakCollectionObjectGroup: function()529 {530 return JSON.stringify(this._objectId) + "-WeakMap";531 536 } 532 537 }; 533 538 534 WebInspector.RemoteObjectProperty = function(name, value, descriptor) 539 // FIXME: Phase out this deprecated class. 540 WebInspector.DeprecatedRemoteObjectProperty = class DeprecatedRemoteObjectProperty 535 541 { 536 this.name = name; 537 this.value = value; 538 this.enumerable = descriptor ? !!descriptor.enumerable : true; 539 this.writable = descriptor ? !!descriptor.writable : true; 540 if (descriptor && descriptor.wasThrown) 541 this.wasThrown = true; 542 constructor(name, value, descriptor) 543 { 544 this.name = name; 545 this.value = value; 546 this.enumerable = descriptor ? !!descriptor.enumerable : true; 547 this.writable = descriptor ? !!descriptor.writable : true; 548 if (descriptor && descriptor.wasThrown) 549 this.wasThrown = true; 550 } 551 552 // Static 553 554 fromPrimitiveValue(name, value) 555 { 556 return new WebInspector.DeprecatedRemoteObjectProperty(name, WebInspector.RemoteObject.fromPrimitiveValue(value)); 557 } 542 558 }; 543 544 WebInspector.RemoteObjectProperty.fromPrimitiveValue = function(name, value)545 {546 return new WebInspector.RemoteObjectProperty(name, WebInspector.RemoteObject.fromPrimitiveValue(value));547 }; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/ReplayObserver.js
r181769 r182039 25 25 */ 26 26 27 WebInspector.ReplayPosition = function(segmentOffset, inputOffset) 27 // FIXME: This ReplayPosition class shouldn't be here, no matter how simple it is. 28 WebInspector.ReplayPosition = class ReplayPosition 28 29 { 29 this.segmentOffset = segmentOffset; 30 this.inputOffset = inputOffset; 30 constructor(segmentOffset, inputOffset) 31 { 32 this.segmentOffset = segmentOffset; 33 this.inputOffset = inputOffset; 34 } 31 35 }; 32 36 33 WebInspector.Replay Position.fromProtocol = function(payload)37 WebInspector.ReplayObserver = class ReplayObserver 34 38 { 35 return new WebInspector.ReplayPosition(payload.segmentOffset, payload.inputOffset); 36 }; 39 // Events defined by the "Replay" domain. 37 40 38 WebInspector.ReplayObserver = function() 39 { 40 // FIXME: Convert this to a WebInspector.Object subclass, and call super(). 41 // WebInspector.Object.call(this); 42 }; 43 44 WebInspector.ReplayObserver.prototype = { 45 constructor: WebInspector.ReplayObserver, 46 __proto__: WebInspector.Object.prototype, 47 48 captureStarted: function() 41 captureStarted() 49 42 { 50 43 WebInspector.replayManager.captureStarted(); 51 } ,44 } 52 45 53 captureStopped : function()46 captureStopped() 54 47 { 55 48 WebInspector.replayManager.captureStopped(); 56 } ,49 } 57 50 58 playbackStarted : function()51 playbackStarted() 59 52 { 60 53 WebInspector.replayManager.playbackStarted(); 61 } ,54 } 62 55 63 playbackHitPosition : function(replayPosition, timestamp)56 playbackHitPosition(replayPosition, timestamp) 64 57 { 65 WebInspector.replayManager.playbackHitPosition( WebInspector.ReplayPosition.fromProtocol(replayPosition), timestamp);66 } ,58 WebInspector.replayManager.playbackHitPosition(new WebInspector.ReplayPosition(replayPosition.segmentOffset, replayPosition.inputOffset), timestamp); 59 } 67 60 68 playbackPaused : function(replayPosition)61 playbackPaused(replayPosition) 69 62 { 70 WebInspector.replayManager.playbackPaused( WebInspector.ReplayPosition.fromProtocol(replayPosition));71 } ,63 WebInspector.replayManager.playbackPaused(new WebInspector.ReplayPosition(replayPosition.segmentOffset, replayPosition.inputOffset)); 64 } 72 65 73 playbackFinished : function()66 playbackFinished() 74 67 { 75 68 WebInspector.replayManager.playbackFinished(); 76 } ,69 } 77 70 78 inputSuppressionChanged : function(willSuppress)71 inputSuppressionChanged(willSuppress) 79 72 { 80 73 // Not handled yet. 81 } ,74 } 82 75 83 sessionCreated : function(sessionId)76 sessionCreated(sessionId) 84 77 { 85 78 WebInspector.replayManager.sessionCreated(sessionId); 86 } ,79 } 87 80 88 sessionModified : function(sessionId)81 sessionModified(sessionId) 89 82 { 90 83 WebInspector.replayManager.sessionModified(sessionId); 91 } ,84 } 92 85 93 sessionRemoved : function(sessionId)86 sessionRemoved(sessionId) 94 87 { 95 88 WebInspector.replayManager.sessionRemoved(sessionId); 96 } ,89 } 97 90 98 sessionLoaded : function(sessionId)91 sessionLoaded(sessionId) 99 92 { 100 93 WebInspector.replayManager.sessionLoaded(sessionId); 101 } ,94 } 102 95 103 segmentCreated : function(segmentId)96 segmentCreated(segmentId) 104 97 { 105 98 WebInspector.replayManager.segmentCreated(segmentId); 106 } ,99 } 107 100 108 segmentRemoved : function(segmentId)101 segmentRemoved(segmentId) 109 102 { 110 103 WebInspector.replayManager.segmentRemoved(segmentId); 111 } ,104 } 112 105 113 segmentCompleted : function(segmentId)106 segmentCompleted(segmentId) 114 107 { 115 108 WebInspector.replayManager.segmentCompleted(segmentId); 116 } ,109 } 117 110 118 segmentLoaded : function(segmentId)111 segmentLoaded(segmentId) 119 112 { 120 113 WebInspector.replayManager.segmentLoaded(segmentId); 121 } ,114 } 122 115 123 segmentUnloaded : function()116 segmentUnloaded() 124 117 { 125 118 WebInspector.replayManager.segmentUnloaded(); -
trunk/Source/WebInspectorUI/UserInterface/Protocol/RuntimeObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.RuntimeObserver = function()26 WebInspector.RuntimeObserver = class RuntimeObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.RuntimeObserver.prototype = {33 constructor: WebInspector.RuntimeObserver,34 35 28 // Events defined by the "Runtime" domain. 36 29 37 executionContextCreated : function(contextPayload)30 executionContextCreated(contextPayload) 38 31 { 39 32 WebInspector.frameResourceManager.executionContextCreated(contextPayload); 40 33 } 41 34 }; 42 43 WebInspector.RuntimeObserver.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js
r181769 r182039 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 WebInspector.TimelineObserver = function()26 WebInspector.TimelineObserver = class TimelineObserver 27 27 { 28 // FIXME: Convert this to a WebInspector.Object subclass, and call super().29 // WebInspector.Object.call(this);30 };31 32 WebInspector.TimelineObserver.prototype = {33 constructor: WebInspector.TimelineObserver,34 35 28 // Events defined by the "Timeline" domain. 36 29 37 eventRecorded : function(record)30 eventRecorded(record) 38 31 { 39 32 WebInspector.timelineManager.eventRecorded(record); 40 } ,33 } 41 34 42 recordingStarted : function()35 recordingStarted() 43 36 { 44 37 WebInspector.timelineManager.capturingStarted(); 45 } ,38 } 46 39 47 recordingStopped : function()40 recordingStopped() 48 41 { 49 42 WebInspector.timelineManager.capturingStopped(); 50 43 } 51 44 }; 52 53 WebInspector.TimelineObserver.prototype.__proto__ = WebInspector.Object.prototype;
Note: See TracChangeset
for help on using the changeset viewer.