diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-16 14:56:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-16 14:57:30 +0200 |
commit | b297e0fa5c217c9467033b7c8b46891a52870120 (patch) | |
tree | 43fc14689295e9e64f2719d05aad94e3049f6cd7 /Source/WebCore/inspector | |
parent | 69d517dbfa69903d8593cc1737f0474b21e3251e (diff) | |
download | qtwebkit-b297e0fa5c217c9467033b7c8b46891a52870120.tar.gz |
Revert "Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)"
This reverts commit 5466563f4b5b6b86523e3f89bb7f77e5b5270c78.
Caused OOM issues on some CI machines :(
Diffstat (limited to 'Source/WebCore/inspector')
234 files changed, 3021 insertions, 4354 deletions
diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index 81711ff54..6f4d1f701 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -56,7 +56,7 @@ TYPE_NAME_FIX_MAP = { } -TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor", "Runtime.InternalPropertyDescriptor", +TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor", "Debugger.FunctionDetails", "Debugger.CallFrame", "Canvas.TraceLog", # This should be a temporary hack. TimelineEvent should be created via generated C++ API. "Timeline.TimelineEvent"]) @@ -1319,7 +1319,7 @@ class TypeBindings: validator_writer.newline(" InspectorObject::iterator %s;\n" % it_name) validator_writer.newline(" %s = object->find(\"%s\");\n" % (it_name, prop_data.p["name"])) validator_writer.newline(" ASSERT(%s != object->end());\n" % it_name) - validator_writer.newline(" %s(%s->value.get());\n" % (prop_data.param_type_binding.get_validator_call_text(), it_name)) + validator_writer.newline(" %s(%s->second.get());\n" % (prop_data.param_type_binding.get_validator_call_text(), it_name)) validator_writer.newline(" }\n") if closed_field_set: @@ -1331,7 +1331,7 @@ class TypeBindings: validator_writer.newline(" InspectorObject::iterator %s;\n" % it_name) validator_writer.newline(" %s = object->find(\"%s\");\n" % (it_name, prop_data.p["name"])) validator_writer.newline(" if (%s != object->end()) {\n" % it_name) - validator_writer.newline(" %s(%s->value.get());\n" % (prop_data.param_type_binding.get_validator_call_text(), it_name)) + validator_writer.newline(" %s(%s->second.get());\n" % (prop_data.param_type_binding.get_validator_call_text(), it_name)) if closed_field_set: validator_writer.newline(" ++foundPropertiesCount;\n") validator_writer.newline(" }\n") @@ -2044,7 +2044,7 @@ $messageHandlers return; } - ((*this).*it->value)(callId, messageObject.get()); + ((*this).*it->second)(callId, messageObject.get()); } void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr<InspectorObject> result, const char* commandName, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError) @@ -2133,7 +2133,7 @@ R InspectorBackendDispatcherImpl::getPropertyValueImpl(InspectorObject* object, return value; } - if (!as_method(valueIterator->value.get(), &value)) + if (!as_method(valueIterator->second.get(), &value)) protocolErrors->pushString(String::format("Parameter '%s' has wrong type. It must be '%s'.", name.utf8().data(), type_name)); else if (valueFound) diff --git a/Source/WebCore/inspector/DOMPatchSupport.cpp b/Source/WebCore/inspector/DOMPatchSupport.cpp index 8e6c1800d..c03dce471 100644 --- a/Source/WebCore/inspector/DOMPatchSupport.cpp +++ b/Source/WebCore/inspector/DOMPatchSupport.cpp @@ -237,24 +237,24 @@ DOMPatchSupport::diff(const Vector<OwnPtr<Digest> >& oldList, const Vector<OwnPt for (size_t i = 0; i < newList.size(); ++i) { DiffTable::iterator it = newTable.add(newList[i]->m_sha1, Vector<size_t>()).iterator; - it->value.append(i); + it->second.append(i); } for (size_t i = 0; i < oldList.size(); ++i) { DiffTable::iterator it = oldTable.add(oldList[i]->m_sha1, Vector<size_t>()).iterator; - it->value.append(i); + it->second.append(i); } for (DiffTable::iterator newIt = newTable.begin(); newIt != newTable.end(); ++newIt) { - if (newIt->value.size() != 1) + if (newIt->second.size() != 1) continue; - DiffTable::iterator oldIt = oldTable.find(newIt->key); - if (oldIt == oldTable.end() || oldIt->value.size() != 1) + DiffTable::iterator oldIt = oldTable.find(newIt->first); + if (oldIt == oldTable.end() || oldIt->second.size() != 1) continue; - newMap[newIt->value[0]] = make_pair(newList[newIt->value[0]].get(), oldIt->value[0]); - oldMap[oldIt->value[0]] = make_pair(oldList[oldIt->value[0]].get(), newIt->value[0]); + newMap[newIt->second[0]] = make_pair(newList[newIt->second[0]].get(), oldIt->second[0]); + oldMap[oldIt->second[0]] = make_pair(oldList[oldIt->second[0]].get(), newIt->second[0]); } for (size_t i = 0; newList.size() > 0 && i < newList.size() - 1; ++i) { @@ -364,7 +364,7 @@ bool DOMPatchSupport::innerPatchChildren(ContainerNode* parentNode, const Vector // 2. Patch nodes marked for merge. for (HashMap<Digest*, Digest*>::iterator it = merges.begin(); it != merges.end(); ++it) { - if (!innerPatchNode(it->value, it->key, ec)) + if (!innerPatchNode(it->second, it->first, ec)) return false; } @@ -463,7 +463,7 @@ bool DOMPatchSupport::removeChildAndMoveToNew(Digest* oldDigest, ExceptionCode& // high that it will get merged back into the original DOM during the further patching. UnusedNodesMap::iterator it = m_unusedNodesMap.find(oldDigest->m_sha1); if (it != m_unusedNodesMap.end()) { - Digest* newDigest = it->value; + Digest* newDigest = it->second; Node* newNode = newDigest->m_node; if (!m_domEditor->replaceChild(newNode->parentNode(), oldNode, newNode, ec)) return false; diff --git a/Source/WebCore/inspector/InjectedScript.cpp b/Source/WebCore/inspector/InjectedScript.cpp index 67dd39e90..6a44ca7b5 100644 --- a/Source/WebCore/inspector/InjectedScript.cpp +++ b/Source/WebCore/inspector/InjectedScript.cpp @@ -45,7 +45,6 @@ using WebCore::TypeBuilder::Array; using WebCore::TypeBuilder::Debugger::CallFrame; using WebCore::TypeBuilder::Runtime::PropertyDescriptor; -using WebCore::TypeBuilder::Runtime::InternalPropertyDescriptor; using WebCore::TypeBuilder::Debugger::FunctionDetails; using WebCore::TypeBuilder::Runtime::RemoteObject; @@ -142,22 +141,6 @@ void InjectedScript::getProperties(ErrorString* errorString, const String& objec *properties = Array<PropertyDescriptor>::runtimeCast(result); } -void InjectedScript::getInternalProperties(ErrorString* errorString, const String& objectId, RefPtr<Array<InternalPropertyDescriptor> >* properties) -{ - ScriptFunctionCall function(injectedScriptObject(), "getInternalProperties"); - function.appendArgument(objectId); - - RefPtr<InspectorValue> result; - makeCall(function, &result); - if (!result || result->type() != InspectorValue::TypeArray) { - *errorString = "Internal error"; - return; - } - RefPtr<Array<InternalPropertyDescriptor> > array = Array<InternalPropertyDescriptor>::runtimeCast(result); - if (array->length() > 0) - *properties = array; -} - Node* InjectedScript::nodeForObjectId(const String& objectId) { if (hasNoValue() || !canAccessInspectedWindow()) diff --git a/Source/WebCore/inspector/InjectedScript.h b/Source/WebCore/inspector/InjectedScript.h index 8a6f33b16..44274278d 100644 --- a/Source/WebCore/inspector/InjectedScript.h +++ b/Source/WebCore/inspector/InjectedScript.h @@ -79,7 +79,6 @@ public: void restartFrame(ErrorString*, const ScriptValue& callFrames, const String& callFrameId, RefPtr<InspectorObject>* result); void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>* result); void getProperties(ErrorString*, const String& objectId, bool ownProperties, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor> >* result); - void getInternalProperties(ErrorString*, const String& objectId, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* result); Node* nodeForObjectId(const String& objectId); void releaseObject(const String& objectId); diff --git a/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js b/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js index 3295fc4c9..26afeeb54 100644 --- a/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js +++ b/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js @@ -215,11 +215,11 @@ StackTraceV8.prototype = { this._stackTrace = this._error.stack; Error.prepareStackTrace = oldPrepareStackTrace; delete this._error; // No longer needed, free memory. - }, - - __proto__: StackTrace.prototype + } } +StackTraceV8.prototype.__proto__ = StackTrace.prototype; + /** * @constructor */ @@ -288,9 +288,6 @@ function Call(thisObject, functionName, args, result, stackTrace) this._args = Array.prototype.slice.call(args, 0); this._result = result; this._stackTrace = stackTrace || null; - - if (!this._functionName) - console.assert(this._args.length === 2 && typeof this._args[0] === "string"); } Call.prototype = { @@ -311,14 +308,6 @@ Call.prototype = { }, /** - * @return {boolean} - */ - isPropertySetter: function() - { - return !this._functionName; - }, - - /** * @return {Array} */ args: function() @@ -393,24 +382,18 @@ Call.prototype = { replay: function(replayableCall, cache) { var replayObject = ReplayableResource.replay(replayableCall.resource(), cache); + var replayFunction = replayObject[replayableCall.functionName()]; + console.assert(typeof replayFunction === "function", "Expected a function to replay"); var replayArgs = replayableCall.args().map(function(obj) { return ReplayableResource.replay(obj, cache); }); - var replayResult = undefined; - - if (replayableCall.isPropertySetter()) - replayObject[replayArgs[0]] = replayArgs[1]; - else { - var replayFunction = replayObject[replayableCall.functionName()]; - console.assert(typeof replayFunction === "function", "Expected a function to replay"); - replayResult = replayFunction.apply(replayObject, replayArgs); - if (replayableCall.result() instanceof ReplayableResource) { - var resource = replayableCall.result().replay(cache); - if (!resource.wrappedObject()) - resource.setWrappedObject(replayResult); - } + var replayResult = replayFunction.apply(replayObject, replayArgs); + if (replayableCall.result() instanceof ReplayableResource) { + var resource = replayableCall.result().replay(cache); + if (!resource.wrappedObject()) + resource.setWrappedObject(replayResult); } - + this._thisObject = replayObject; this._functionName = replayableCall.functionName(); this._args = replayArgs; @@ -456,14 +439,6 @@ ReplayableCall.prototype = { }, /** - * @return {boolean} - */ - isPropertySetter: function() - { - return !this._functionName; - }, - - /** * @return {Array.<ReplayableResource|*>} */ args: function() @@ -569,7 +544,7 @@ Resource.prototype = { }, /** - * @param {*} value + * @param {Object} value */ setWrappedObject: function(value) { @@ -619,7 +594,7 @@ Resource.prototype = { */ toReplayable: function(cache) { - var result = /** @type {ReplayableResource} */ cache.get(this._id); + var result = cache.get(this._id); if (result) return result; var data = { @@ -646,11 +621,11 @@ Resource.prototype = { /** * @param {Object} data * @param {Cache} cache - * @return {Resource|ReplayableResource} + * @return {Resource} */ replay: function(data, cache) { - var resource = /** @type {ReplayableResource} */ cache.get(data.id); + var resource = cache.get(data.id); if (resource) return resource; this._id = data.id; @@ -683,11 +658,11 @@ Resource.prototype = { }, /** - * @param {*} object + * @param {!Object} object */ _bindObjectToResource: function(object) { - Object.defineProperty(/** @type {!Object} */ (object), "__resourceObject", { + Object.defineProperty(object, "__resourceObject", { value: this, writable: false, enumerable: false, @@ -724,7 +699,12 @@ Resource.prototype = { { return wrappedObject[property]; }, - set: self._wrapPropertySetter(self, wrappedObject, property), + set: function(value) + { + // FIXME: Log the setter calls. + console.error("FIXME: Setting an attribute %s was not logged.", property); + wrappedObject[property] = value; + }, enumerable: true }); } @@ -793,30 +773,6 @@ Resource.prototype = { }, /** - * @param {Resource} resource - * @param {Object} originalObject - * @param {string} propertyName - * @return {Function} - */ - _wrapPropertySetter: function(resource, originalObject, propertyName) - { - return function(value) - { - var manager = resource.manager(); - if (!manager || !manager.capturing()) { - originalObject[propertyName] = value; - return; - } - var args = [propertyName, value]; - manager.captureArguments(resource, args); - originalObject[propertyName] = value; - var stackTrace = StackTrace.create(1, arguments.callee); - var call = new Call(resource, "", args, undefined, stackTrace); - manager.captureCall(call); - }; - }, - - /** * @return {Object.<string, Function>} */ _customWrapFunctions: function() @@ -1020,11 +976,11 @@ WebGLBoundResource.prototype = { this._state.BINDING = target; this.pushCall(new Call(WebGLRenderingContextResource.forObject(this), bindMethodName, [target, this])); } - }, - - __proto__: Resource.prototype + } } +WebGLBoundResource.prototype.__proto__ = Resource.prototype; + /** * @constructor * @extends {WebGLBoundResource} @@ -1107,14 +1063,13 @@ WebGLTextureResource.prototype = { console.error("ASSERT_NOT_REACHED: Could not properly process a gl." + call.functionName() + " call while the DRAWING BUFFER is bound."); } this.pushCall(call); - }, + } +} - pushCall_texParameteri: WebGLTextureResource.prototype.pushCall_texParameterf, +WebGLTextureResource.prototype.pushCall_texParameteri = WebGLTextureResource.prototype.pushCall_texParameterf; +WebGLTextureResource.prototype.pushCall_copyTexSubImage2D = WebGLTextureResource.prototype.pushCall_copyTexImage2D; - pushCall_copyTexSubImage2D: WebGLTextureResource.prototype.pushCall_copyTexImage2D, - - __proto__: WebGLBoundResource.prototype -} +WebGLTextureResource.prototype.__proto__ = WebGLBoundResource.prototype; /** * @constructor @@ -1235,11 +1190,11 @@ WebGLProgramResource.prototype = { // FIXME: remove any older calls that no longer contribute to the resource state. // FIXME: handle multiple attachShader && detachShader. Resource.prototype.pushCall.call(this, call); - }, - - __proto__: Resource.prototype + } } +WebGLProgramResource.prototype.__proto__ = Resource.prototype; + /** * @constructor * @extends {Resource} @@ -1259,11 +1214,11 @@ WebGLShaderResource.prototype = { // FIXME: remove any older calls that no longer contribute to the resource state. // FIXME: handle multiple shaderSource calls. Resource.prototype.pushCall.call(this, call); - }, - - __proto__: Resource.prototype + } } +WebGLShaderResource.prototype.__proto__ = Resource.prototype; + /** * @constructor * @extends {WebGLBoundResource} @@ -1283,11 +1238,11 @@ WebGLBufferResource.prototype = { // FIXME: remove any older calls that no longer contribute to the resource state. // FIXME: Optimize memory for bufferSubData. WebGLBoundResource.prototype.pushCall.call(this, call); - }, - - __proto__: WebGLBoundResource.prototype + } } +WebGLBufferResource.prototype.__proto__ = WebGLBoundResource.prototype; + /** * @constructor * @extends {WebGLBoundResource} @@ -1306,11 +1261,11 @@ WebGLFramebufferResource.prototype = { { // FIXME: remove any older calls that no longer contribute to the resource state. WebGLBoundResource.prototype.pushCall.call(this, call); - }, - - __proto__: WebGLBoundResource.prototype + } } +WebGLFramebufferResource.prototype.__proto__ = WebGLBoundResource.prototype; + /** * @constructor * @extends {WebGLBoundResource} @@ -1329,11 +1284,11 @@ WebGLRenderbufferResource.prototype = { { // FIXME: remove any older calls that no longer contribute to the resource state. WebGLBoundResource.prototype.pushCall.call(this, call); - }, - - __proto__: WebGLBoundResource.prototype + } } +WebGLRenderbufferResource.prototype.__proto__ = WebGLBoundResource.prototype; + /** * @constructor * @extends {Resource} @@ -1800,11 +1755,11 @@ WebGLRenderingContextResource.prototype = { WebGLRenderingContextResource._wrapFunctions = wrapFunctions; } return wrapFunctions; - }, - - __proto__: Resource.prototype + } } +WebGLRenderingContextResource.prototype.__proto__ = Resource.prototype; + //////////////////////////////////////////////////////////////////////////////// // 2D Canvas //////////////////////////////////////////////////////////////////////////////// @@ -2021,10 +1976,10 @@ CanvasRenderingContext2DResource.prototype = { CanvasRenderingContext2DResource._wrapFunctions = wrapFunctions; } return wrapFunctions; - }, + } +}; - __proto__: Resource.prototype -} +CanvasRenderingContext2DResource.prototype.__proto__ = Resource.prototype; /** * @constructor @@ -2315,20 +2270,14 @@ InjectedScript.prototype = { var stackTrace = call.stackTrace(); var callFrame = stackTrace ? stackTrace.callFrame(0) || {} : {}; var traceLogItem = { + functionName: call.functionName(), + arguments: args, sourceURL: callFrame.sourceURL, lineNumber: callFrame.lineNumber, columnNumber: callFrame.columnNumber }; - if (call.functionName()) { - traceLogItem.functionName = call.functionName(); - traceLogItem.arguments = args; - } else { - traceLogItem.property = args[0]; - traceLogItem.value = args[1]; - } - var callResult = call.result(); - if (callResult !== undefined && callResult !== null) - traceLogItem.result = callResult + ""; + if (call.result()) + traceLogItem.result = call.result() + ""; result.calls.push(traceLogItem); } return result; diff --git a/Source/WebCore/inspector/InjectedScriptExterns.js b/Source/WebCore/inspector/InjectedScriptExterns.js index 436bdd03f..317087a0d 100644 --- a/Source/WebCore/inspector/InjectedScriptExterns.js +++ b/Source/WebCore/inspector/InjectedScriptExterns.js @@ -38,7 +38,6 @@ console.log = function(vararg) { } */ function InjectedScriptHost() { } InjectedScriptHost.prototype.storageId = function(object) { } -InjectedScriptHost.prototype.getInternalProperties = function(object) { } /** * @param {Function} func */ diff --git a/Source/WebCore/inspector/InjectedScriptHost.idl b/Source/WebCore/inspector/InjectedScriptHost.idl index 883b5ffd1..d144dd09a 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.idl +++ b/Source/WebCore/inspector/InjectedScriptHost.idl @@ -30,22 +30,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=INSPECTOR -] interface InjectedScriptHost { - void clearConsoleMessages(); +module core { + interface [ + Conditional=INSPECTOR + ] InjectedScriptHost { + void clearConsoleMessages(); - void copyText(in DOMString text); - [Custom] void inspect(in DOMObject objectId, in DOMObject hints); - [Custom] DOMObject inspectedObject(in int num); - [Custom] DOMObject internalConstructorName(in DOMObject object); - [Custom] boolean isHTMLAllCollection(in DOMObject object); - [Custom] DOMString type(in DOMObject object); - [Custom] DOMObject functionDetails(in DOMObject object); - [Custom] Array getInternalProperties(in DOMObject object); - [Custom] Array getEventListeners(in Node node); + void copyText(in DOMString text); + [Custom] void inspect(in DOMObject objectId, in DOMObject hints); + [Custom] DOMObject inspectedObject(in int num); + [Custom] DOMObject internalConstructorName(in DOMObject object); + [Custom] boolean isHTMLAllCollection(in DOMObject object); + [Custom] DOMString type(in DOMObject object); + [Custom] DOMObject functionDetails(in DOMObject object); + [Custom] Array getEventListeners(in Node node); + + [Custom] DOMString databaseId(in DOMObject database); + [Custom] DOMString storageId(in DOMObject storage); + [Custom] DOMObject evaluate(in DOMString text); + }; +} - [Custom] DOMString databaseId(in DOMObject database); - [Custom] DOMString storageId(in DOMObject storage); - [Custom] DOMObject evaluate(in DOMString text); -}; diff --git a/Source/WebCore/inspector/InjectedScriptManager.cpp b/Source/WebCore/inspector/InjectedScriptManager.cpp index 1d5e31757..52ec7490a 100644 --- a/Source/WebCore/inspector/InjectedScriptManager.cpp +++ b/Source/WebCore/inspector/InjectedScriptManager.cpp @@ -82,10 +82,10 @@ InjectedScript InjectedScriptManager::injectedScriptForId(int id) { IdToInjectedScriptMap::iterator it = m_idToInjectedScript.find(id); if (it != m_idToInjectedScript.end()) - return it->value; + return it->second; for (ScriptStateToId::iterator it = m_scriptStateToId.begin(); it != m_scriptStateToId.end(); ++it) { - if (it->value == id) - return injectedScriptFor(it->key); + if (it->second == id) + return injectedScriptFor(it->first); } return InjectedScript(); } @@ -94,7 +94,7 @@ int InjectedScriptManager::injectedScriptIdFor(ScriptState* scriptState) { ScriptStateToId::iterator it = m_scriptStateToId.find(scriptState); if (it != m_scriptStateToId.end()) - return it->value; + return it->second; int id = m_nextInjectedScriptId++; m_scriptStateToId.set(scriptState, id); return id; @@ -126,11 +126,11 @@ void InjectedScriptManager::discardInjectedScriptsFor(DOMWindow* window) Vector<long> idsToRemove; IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end(); for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != end; ++it) { - ScriptState* scriptState = it->value.scriptState(); + ScriptState* scriptState = it->second.scriptState(); if (window != domWindowFromScriptState(scriptState)) continue; m_scriptStateToId.remove(scriptState); - idsToRemove.append(it->key); + idsToRemove.append(it->first); } for (size_t i = 0; i < idsToRemove.size(); i++) @@ -139,7 +139,7 @@ void InjectedScriptManager::discardInjectedScriptsFor(DOMWindow* window) // Now remove script states that have id but no injected script. Vector<ScriptState*> scriptStatesToRemove; for (ScriptStateToId::iterator it = m_scriptStateToId.begin(); it != m_scriptStateToId.end(); ++it) { - ScriptState* scriptState = it->key; + ScriptState* scriptState = it->first; if (window == domWindowFromScriptState(scriptState)) scriptStatesToRemove.append(scriptState); } @@ -155,7 +155,7 @@ bool InjectedScriptManager::canAccessInspectedWorkerContext(ScriptState*) void InjectedScriptManager::releaseObjectGroup(const String& objectGroup) { for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it) - it->value.releaseObjectGroup(objectGroup); + it->second.releaseObjectGroup(objectGroup); } String InjectedScriptManager::injectedScriptSource() @@ -173,9 +173,9 @@ InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState* inspectedSc { ScriptStateToId::iterator it = m_scriptStateToId.find(inspectedScriptState); if (it != m_scriptStateToId.end()) { - IdToInjectedScriptMap::iterator it1 = m_idToInjectedScript.find(it->value); + IdToInjectedScriptMap::iterator it1 = m_idToInjectedScript.find(it->second); if (it1 != m_idToInjectedScript.end()) - return it1->value; + return it1->second; } if (!m_inspectedStateAccessCheck(inspectedScriptState)) diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js index ecf66af08..1688015a4 100644 --- a/Source/WebCore/inspector/InjectedScriptSource.js +++ b/Source/WebCore/inspector/InjectedScriptSource.js @@ -34,42 +34,6 @@ (function (InjectedScriptHost, inspectedWindow, injectedScriptId) { /** - * @param {Arguments} array - * @param {number=} index - * @return {Array.<*>} - */ -function slice(array, index) -{ - var result = []; - for (var i = index || 0; i < array.length; ++i) - result.push(array[i]); - return result; -} - -/** - * Please use this bind, not the one from Function.prototype - * @param {function()} func - * @param {Object} thisObject - * @param {...number} var_args - */ -function bind(func, thisObject, var_args) -{ - var args = slice(arguments, 2); - - /** - * @param {...number} var_args - */ - function bound(var_args) - { - return func.apply(thisObject, args.concat(slice(arguments))); - } - bound.toString = function() { - return "bound: " + func; - }; - return bound; -} - -/** * @constructor */ var InjectedScript = function() @@ -206,7 +170,7 @@ InjectedScript.prototype = { /** * @param {string} objectId - * @return {Object} + * @return {*} */ _parseObjectId: function(objectId) { @@ -270,32 +234,7 @@ InjectedScript.prototype = { descriptor.configurable = false; if (!("enumerable" in descriptor)) descriptor.enumerable = false; - } - return descriptors; - }, - - /** - * @param {string} objectId - * @return {Array.<Object>|boolean} - */ - getInternalProperties: function(objectId, ownProperties) - { - var parsedObjectId = this._parseObjectId(objectId); - var object = this._objectForId(parsedObjectId); - var objectGroupName = this._idToObjectGroupName[parsedObjectId.id]; - if (!this._isDefined(object)) - return false; - var descriptors = []; - var internalProperties = InjectedScriptHost.getInternalProperties(object); - if (internalProperties) { - for (var i = 0; i < internalProperties.length; i++) { - var property = internalProperties[i]; - var descriptor = { - name: property.name, - value: this._wrapObject(property.value, objectGroupName) - }; - descriptors.push(descriptor); - } + } return descriptors; }, @@ -420,7 +359,7 @@ InjectedScript.prototype = { objectId = args[i].objectId; if (objectId) { var parsedArgId = this._parseObjectId(objectId); - if (!parsedArgId || parsedArgId["injectedScriptId"] !== injectedScriptId) + if (!parsedArgId || parsedArgId.injectedScriptId !== injectedScriptId) return "Arguments should belong to the same JavaScript world as the target object."; var resolvedArg = this._objectForId(parsedArgId); @@ -606,7 +545,7 @@ InjectedScript.prototype = { var object = this.findObjectById(objectId); if (!object || this._subtype(object) !== "node") return null; - return /** @type {Node} */ object; + return object; }, /** @@ -642,7 +581,7 @@ InjectedScript.prototype = { */ _isDefined: function(object) { - return !!object || this._isHTMLAllCollection(object); + return object || this._isHTMLAllCollection(object); }, /** @@ -697,8 +636,6 @@ InjectedScript.prototype = { if (this.isPrimitiveValue(obj)) return null; - obj = /** @type {Object} */ obj; - // Type is object, get subtype. var subtype = this._subtype(obj); @@ -784,8 +721,6 @@ InjectedScript.RemoteObject = function(object, objectGroupName, forceValueType, return; } - object = /** @type {Object} */ object; - this.objectId = injectedScript._bind(object, objectGroupName); var subtype = injectedScript._subtype(object); if (subtype) @@ -794,12 +729,12 @@ InjectedScript.RemoteObject = function(object, objectGroupName, forceValueType, this.description = injectedScript._describe(object); if (generatePreview && (this.type === "object" || injectedScript._isHTMLAllCollection(object))) - this._generatePreview(object); + this._generatePreview(/** @type {!Object} */ object); } InjectedScript.RemoteObject.prototype = { /** - * @param {Object} object + * @param {!Object} object */ _generatePreview: function(object) { @@ -807,7 +742,7 @@ InjectedScript.RemoteObject.prototype = { var isArray = this.subtype === "array"; var elementsToDump = isArray ? 100 : 5; - var propertyNames = Object.getOwnPropertyNames(/** @type {!Object} */(object)); + var propertyNames = Object.getOwnPropertyNames(object); preview.lossless = true; preview.overflow = false; var properties = preview.properties = []; @@ -823,7 +758,7 @@ InjectedScript.RemoteObject.prototype = { if (isArray && name === "length") continue; - var descriptor = Object.getOwnPropertyDescriptor(/** @type {!Object} */(object), name); + var descriptor = Object.getOwnPropertyDescriptor(object, name); if (!("value" in descriptor) || !descriptor.enumerable) { preview.lossless = false; continue; @@ -856,7 +791,7 @@ InjectedScript.RemoteObject.prototype = { continue; var subtype = injectedScript._subtype(value); - var property = { name: name, type: type, value: this._abbreviateString(/** @type {string} */ (injectedScript._describe(value)), maxLength, subtype === "regexp") }; + var property = { name: name, type: type, value: this._abbreviateString(injectedScript._describe(value), maxLength, subtype === "regexp") }; if (subtype) property.subtype = subtype; properties.push(property); @@ -971,7 +906,7 @@ function CommandLineAPI(commandLineAPIImpl, callFrame) if (member in inspectedWindow || inScopeVariables(member)) continue; - this[member] = bind(commandLineAPIImpl[member], commandLineAPIImpl); + this[member] = commandLineAPIImpl[member].bind(commandLineAPIImpl); } for (var i = 0; i < 5; ++i) { @@ -979,7 +914,7 @@ function CommandLineAPI(commandLineAPIImpl, callFrame) if (member in inspectedWindow || inScopeVariables(member)) continue; - this.__defineGetter__("$" + i, bind(commandLineAPIImpl._inspectedObject, commandLineAPIImpl, i)); + this.__defineGetter__("$" + i, commandLineAPIImpl._inspectedObject.bind(commandLineAPIImpl, i)); } this.$_ = injectedScript._lastResult; @@ -1036,7 +971,7 @@ CommandLineAPIImpl.prototype = { }, /** - * @param {Node|undefined} node + * @param {Node} node * @return {boolean} */ _canQuerySelectorOnNode: function(node) diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index 24ebe8828..21d927c21 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -404,14 +404,6 @@ ], "description": "Toggles mouse event-based touch event emulation.", "hidden": true - }, - { - "name": "setCompositingBordersVisible", - "description": "Controls the visibility of compositing borders.", - "parameters": [ - { "name": "visible", "type": "boolean", "description": "True for showing compositing borders." } - ], - "hidden": true } ], "events": [ @@ -506,15 +498,6 @@ ] }, { - "id": "InternalPropertyDescriptor", - "type": "object", - "description": "Object internal property descriptor. This property isn't normally visible in JavaScript code.", - "properties": [ - { "name": "name", "type": "string", "description": "Conventional property name." }, - { "name": "value", "$ref": "RemoteObject", "optional": true, "description": "The value associated with the property." } - ] - }, - { "id": "CallArgument", "type": "object", "description": "Represents function call argument. Either remote object id <code>objectId</code> or primitive <code>value</code> or neither of (for undefined) them should be specified.", @@ -582,8 +565,7 @@ { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the element itself, not to its prototype chain." } ], "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." }, - { "name": "internalProperties", "optional": true, "type": "array", "items": { "$ref": "InternalPropertyDescriptor"}, "description": "Internal object properties." } + { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." } ], "description": "Returns properties of a given object. Object group of the result is inherited from the target object." }, @@ -607,15 +589,14 @@ "description": "Tells inspected instance(worker or page) that it can run in case it was started paused." }, { - "name": "enable", - "hidden": true, - "description": "Enables reporting of execution contexts creation by means of <code>executionContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing execution context." - }, - { - "name": "disable", + "name": "setReportExecutionContextCreation", + "parameters": [ + { "name": "enabled", "type": "boolean", "description": "Reporting enabled state." } + ], "hidden": true, - "description": "Disables reporting of execution contexts creation." + "description": "Enables reporting about creation of execution contexts by means of <code>executionContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing execution context." } + ], "events": [ { @@ -1168,8 +1149,7 @@ "description": "Database with an array of object stores.", "properties": [ { "name": "name", "type": "string", "description": "Database name." }, - { "name": "version", "type": "string", "description": "Deprecated string database version." }, - { "name": "intVersion", "type": "integer", "description": "Integer database version." }, + { "name": "version", "type": "string", "description": "Database version." }, { "name": "objectStores", "type": "array", "items": { "$ref": "ObjectStore" }, "description": "Object stores in this database." } ] }, @@ -2780,8 +2760,7 @@ { "name": "endLine", "type": "integer", "description": "Last line of the script." }, { "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." }, { "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." }, - { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, - { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL." } + { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." } ], "description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger." }, @@ -3121,10 +3100,8 @@ "id": "Call", "type": "object", "properties": [ - { "name": "functionName", "type": "string", "optional": true }, - { "name": "arguments", "type": "array", "items": { "type": "string" }, "optional": true }, - { "name": "property", "type": "string", "optional": true }, - { "name": "value", "type": "string", "optional": true }, + { "name": "functionName", "type": "string" }, + { "name": "arguments", "type": "array", "items": { "type": "string" } }, { "name": "result", "type": "string", "optional": true }, { "name": "sourceURL", "type": "string", "optional": true }, { "name": "lineNumber", "type": "integer", "optional": true }, diff --git a/Source/WebCore/inspector/InspectorBaseAgent.cpp b/Source/WebCore/inspector/InspectorBaseAgent.cpp index ffa9555d4..f3fd92b3a 100644 --- a/Source/WebCore/inspector/InspectorBaseAgent.cpp +++ b/Source/WebCore/inspector/InspectorBaseAgent.cpp @@ -34,14 +34,10 @@ #include "InspectorBaseAgent.h" -#include "WebCoreMemoryInstrumentation.h" - namespace WebCore { -InspectorBaseAgentInterface::InspectorBaseAgentInterface(const String& name, InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState) - : m_instrumentingAgents(instrumentingAgents) - , m_state(inspectorState) - , m_name(name) +InspectorBaseAgentInterface::InspectorBaseAgentInterface(const String& name) + : m_name(name) { } @@ -49,14 +45,6 @@ InspectorBaseAgentInterface::~InspectorBaseAgentInterface() { } -void InspectorBaseAgentInterface::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const -{ - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector); - info.addMember(m_name); - info.addWeakPointer(m_instrumentingAgents); - info.addWeakPointer(m_state); -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorBaseAgent.h b/Source/WebCore/inspector/InspectorBaseAgent.h index 849763fa5..800f96736 100644 --- a/Source/WebCore/inspector/InspectorBaseAgent.h +++ b/Source/WebCore/inspector/InspectorBaseAgent.h @@ -32,7 +32,6 @@ #define InspectorBaseAgent_h #include "InspectorBackendDispatcher.h" -#include <wtf/Forward.h> #include <wtf/Vector.h> #include <wtf/text/WTFString.h> @@ -44,7 +43,7 @@ class InstrumentingAgents; class InspectorBaseAgentInterface { public: - InspectorBaseAgentInterface(const String&, InstrumentingAgents*, InspectorState*); + explicit InspectorBaseAgentInterface(const String& name); virtual ~InspectorBaseAgentInterface(); virtual void setFrontend(InspectorFrontend*) { } @@ -54,13 +53,6 @@ public: virtual void discardAgent() { } String name() { return m_name; } - - virtual void reportMemoryUsage(MemoryObjectInfo*) const; - -protected: - InstrumentingAgents* m_instrumentingAgents; - InspectorState* m_state; - private: String m_name; }; @@ -77,9 +69,14 @@ public: protected: InspectorBaseAgent(const String& name, InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState) - : InspectorBaseAgentInterface(name, instrumentingAgents, inspectorState) + : InspectorBaseAgentInterface(name) + , m_instrumentingAgents(instrumentingAgents) + , m_state(inspectorState) { } + + InstrumentingAgents* m_instrumentingAgents; + InspectorState* m_state; }; } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp index 5cd9c60c9..bbe88d2c0 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.cpp +++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp @@ -188,10 +188,10 @@ inline void SelectorProfile::commitSelector(bool matched) RuleMatchingStatsMap::AddResult result = m_ruleMatchingStats.add(makeKey(), RuleMatchingStats(m_currentMatchData, matchTimeMs, 1, matched ? 1 : 0)); if (!result.isNewEntry) { - result.iterator->value.totalTime += matchTimeMs; - result.iterator->value.hits += 1; + result.iterator->second.totalTime += matchTimeMs; + result.iterator->second.hits += 1; if (matched) - result.iterator->value.matches += 1; + result.iterator->second.matches += 1; } } @@ -204,7 +204,7 @@ inline void SelectorProfile::commitSelectorTime() if (it == m_ruleMatchingStats.end()) return; - it->value.totalTime += processingTimeMs; + it->second.totalTime += processingTimeMs; } PassRefPtr<TypeBuilder::CSS::SelectorProfile> SelectorProfile::toInspectorObject() const @@ -212,12 +212,12 @@ PassRefPtr<TypeBuilder::CSS::SelectorProfile> SelectorProfile::toInspectorObject RefPtr<TypeBuilder::Array<TypeBuilder::CSS::SelectorProfileEntry> > selectorProfileData = TypeBuilder::Array<TypeBuilder::CSS::SelectorProfileEntry>::create(); for (RuleMatchingStatsMap::const_iterator it = m_ruleMatchingStats.begin(); it != m_ruleMatchingStats.end(); ++it) { RefPtr<TypeBuilder::CSS::SelectorProfileEntry> entry = TypeBuilder::CSS::SelectorProfileEntry::create() - .setSelector(it->value.selector) - .setUrl(it->value.url) - .setLineNumber(it->value.lineNumber) - .setTime(it->value.totalTime) - .setHitCount(it->value.hits) - .setMatchCount(it->value.matches); + .setSelector(it->second.selector) + .setUrl(it->second.url) + .setLineNumber(it->second.lineNumber) + .setTime(it->second.totalTime) + .setHitCount(it->second.hits) + .setMatchCount(it->second.matches); selectorProfileData->addItem(entry.release()); } @@ -272,7 +272,7 @@ void UpdateRegionLayoutTask::onTimer(Timer<UpdateRegionLayoutTask>*) Vector<std::pair<WebKitNamedFlow*, int> > namedFlows; for (HashMap<WebKitNamedFlow*, int>::iterator it = m_namedFlows.begin(), end = m_namedFlows.end(); it != end; ++it) - namedFlows.append(std::make_pair(it->key, it->value)); + namedFlows.append(std::make_pair(it->first, it->second)); for (unsigned i = 0, size = namedFlows.size(); i < size; ++i) { WebKitNamedFlow* namedFlow = namedFlows.at(i).first; @@ -663,7 +663,7 @@ bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoTy if (it == m_nodeIdToForcedPseudoState.end()) return false; - unsigned forcedPseudoState = it->value; + unsigned forcedPseudoState = it->second; switch (pseudoType) { case CSSSelector::PseudoActive: return forcedPseudoState & PseudoActive; @@ -904,7 +904,7 @@ void InspectorCSSAgent::forcePseudoState(ErrorString* errorString, int nodeId, c unsigned forcedPseudoState = computePseudoClassMask(forcedPseudoClasses.get()); NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.find(nodeId); - unsigned currentForcedPseudoState = it == m_nodeIdToForcedPseudoState.end() ? 0 : it->value; + unsigned currentForcedPseudoState = it == m_nodeIdToForcedPseudoState.end() ? 0 : it->second; bool needStyleRecalc = forcedPseudoState != currentForcedPseudoState; if (!needStyleRecalc) return; @@ -995,7 +995,7 @@ InspectorStyleSheetForInlineStyle* InspectorCSSAgent::asInspectorStyleSheet(Elem return inspectorStyleSheet.get(); } - return it->value.get(); + return it->second.get(); } Element* InspectorCSSAgent::elementForId(ErrorString* errorString, int nodeId) @@ -1098,7 +1098,7 @@ InspectorStyleSheet* InspectorCSSAgent::assertStyleSheetForId(ErrorString* error *errorString = "No style sheet with given id found"; return 0; } - return it->value.get(); + return it->second.get(); } TypeBuilder::CSS::StyleSheetOrigin::Enum InspectorCSSAgent::detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument) @@ -1266,7 +1266,7 @@ void InspectorCSSAgent::didRemoveDOMNode(Node* node) if (it == m_nodeToInspectorStyleSheet.end()) return; - m_idToInspectorStyleSheet.remove(it->value->id()); + m_idToInspectorStyleSheet.remove(it->second->id()); m_nodeToInspectorStyleSheet.remove(node); } @@ -1279,7 +1279,7 @@ void InspectorCSSAgent::didModifyDOMAttr(Element* element) if (it == m_nodeToInspectorStyleSheet.end()) return; - it->value->didModifyElementAttribute(); + it->second->didModifyElementAttribute(); } void InspectorCSSAgent::styleSheetChanged(InspectorStyleSheet* styleSheet) @@ -1292,7 +1292,7 @@ void InspectorCSSAgent::resetPseudoStates() { HashSet<Document*> documentsToChange; for (NodeIdToForcedPseudoState::iterator it = m_nodeIdToForcedPseudoState.begin(), end = m_nodeIdToForcedPseudoState.end(); it != end; ++it) { - Element* element = toElement(m_domAgent->nodeForId(it->key)); + Element* element = toElement(m_domAgent->nodeForId(it->first)); if (element && element->ownerDocument()) documentsToChange.add(element->ownerDocument()); } diff --git a/Source/WebCore/inspector/InspectorClient.h b/Source/WebCore/inspector/InspectorClient.h index 2d4fb3f26..e8d2659d5 100644 --- a/Source/WebCore/inspector/InspectorClient.h +++ b/Source/WebCore/inspector/InspectorClient.h @@ -29,7 +29,6 @@ #include "InspectorStateClient.h" #include <wtf/Forward.h> -#include <wtf/HashSet.h> namespace WebCore { @@ -72,8 +71,6 @@ public: virtual bool supportsFrameInstrumentation() { return false; } - virtual void getAllocatedObjects(HashSet<const void*>&) { } - static bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message); }; diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.cpp b/Source/WebCore/inspector/InspectorConsoleAgent.cpp index 9e622c04c..aceb2da4a 100644 --- a/Source/WebCore/inspector/InspectorConsoleAgent.cpp +++ b/Source/WebCore/inspector/InspectorConsoleAgent.cpp @@ -42,7 +42,6 @@ #include "ScriptArguments.h" #include "ScriptCallFrame.h" #include "ScriptCallStack.h" -#include "ScriptController.h" #include "ScriptObject.h" #include "ScriptProfiler.h" #include <wtf/CurrentTime.h> @@ -61,15 +60,12 @@ static const char monitoringXHR[] = "monitoringXHR"; static const char consoleMessagesEnabled[] = "consoleMessagesEnabled"; } -int InspectorConsoleAgent::s_enabledAgentCount = 0; - InspectorConsoleAgent::InspectorConsoleAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager) : InspectorBaseAgent<InspectorConsoleAgent>("Console", instrumentingAgents, state) , m_injectedScriptManager(injectedScriptManager) , m_frontend(0) , m_previousMessage(0) , m_expiredConsoleMessageCount(0) - , m_enabled(false) { m_instrumentingAgents->setInspectorConsoleAgent(this); } @@ -84,13 +80,6 @@ InspectorConsoleAgent::~InspectorConsoleAgent() void InspectorConsoleAgent::enable(ErrorString*) { - if (m_enabled) - return; - m_enabled = true; - if (!s_enabledAgentCount) - ScriptController::setCaptureCallStackForUncaughtExceptions(true); - ++s_enabledAgentCount; - m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, true); if (m_expiredConsoleMessageCount) { @@ -105,11 +94,6 @@ void InspectorConsoleAgent::enable(ErrorString*) void InspectorConsoleAgent::disable(ErrorString*) { - if (!m_enabled) - return; - m_enabled = false; - if (!(--s_enabledAgentCount)) - ScriptController::setCaptureCallStackForUncaughtExceptions(false); m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false); } @@ -119,7 +103,7 @@ void InspectorConsoleAgent::clearMessages(ErrorString*) m_expiredConsoleMessageCount = 0; m_previousMessage = 0; m_injectedScriptManager->releaseObjectGroup("console"); - if (m_frontend && m_enabled) + if (m_frontend && m_state->getBoolean(ConsoleAgentState::consoleMessagesEnabled)) m_frontend->messagesCleared(); } @@ -148,8 +132,7 @@ void InspectorConsoleAgent::setFrontend(InspectorFrontend* frontend) void InspectorConsoleAgent::clearFrontend() { m_frontend = 0; - String errorString; - disable(&errorString); + m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false); } void InspectorConsoleAgent::addMessageToConsole(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, PassRefPtr<ScriptCallStack> callStack) @@ -195,7 +178,7 @@ void InspectorConsoleAgent::stopTiming(const String& title, PassRefPtr<ScriptCal if (it == m_times.end()) return; - double startTime = it->value; + double startTime = it->second; m_times.remove(it); double elapsed = monotonicallyIncreasingTime() - startTime; @@ -218,7 +201,7 @@ void InspectorConsoleAgent::count(PassRefPtr<ScriptArguments> arguments, PassRef if (it == m_counts.end()) count = 1; else { - count = it->value + 1; + count = it->second + 1; m_counts.remove(it); } @@ -296,12 +279,12 @@ void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> console if (m_previousMessage && !isGroupMessage(m_previousMessage->type()) && m_previousMessage->isEqual(consoleMessage.get())) { m_previousMessage->incrementCount(); - if (m_frontend && m_enabled) + if (m_frontend && m_state->getBoolean(ConsoleAgentState::consoleMessagesEnabled)) m_previousMessage->updateRepeatCountInConsole(m_frontend); } else { m_previousMessage = consoleMessage.get(); m_consoleMessages.append(consoleMessage); - if (m_frontend && m_enabled) + if (m_frontend && m_state->getBoolean(ConsoleAgentState::consoleMessagesEnabled)) m_previousMessage->addToFrontend(m_frontend, m_injectedScriptManager, true); } diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.h b/Source/WebCore/inspector/InspectorConsoleAgent.h index 7f4339313..52be11818 100644 --- a/Source/WebCore/inspector/InspectorConsoleAgent.h +++ b/Source/WebCore/inspector/InspectorConsoleAgent.h @@ -61,7 +61,6 @@ public: virtual void enable(ErrorString*); virtual void disable(ErrorString*); virtual void clearMessages(ErrorString*); - bool enabled() { return m_enabled; } void reset(); virtual void setFrontend(InspectorFrontend*); @@ -101,9 +100,6 @@ protected: int m_expiredConsoleMessageCount; HashMap<String, unsigned> m_counts; HashMap<String, double> m_times; - bool m_enabled; -private: - static int s_enabledAgentCount; }; } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp index 8bad7cc0c..9bd43311f 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp @@ -71,8 +71,6 @@ #include "Page.h" #include "ScriptObject.h" #include "Settings.h" -#include "WebCoreMemoryInstrumentation.h" -#include <wtf/MemoryInstrumentationVector.h> #include <wtf/UnusedParam.h> namespace WebCore { @@ -116,7 +114,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC OwnPtr<InspectorDOMStorageAgent> domStorageAgentPtr(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get())); InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get(); m_agents.append(domStorageAgentPtr.release()); - m_agents.append(InspectorMemoryAgent::create(m_instrumentingAgents.get(), inspectorClient, m_state.get(), m_page)); + m_agents.append(InspectorMemoryAgent::create(m_instrumentingAgents.get(), m_state.get(), m_page, domStorageAgent)); m_agents.append(InspectorTimelineAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get(), InspectorTimelineAgent::PageInspector, inspectorClient)); m_agents.append(InspectorApplicationCacheAgent::create(m_instrumentingAgents.get(), m_state.get(), pageAgent)); @@ -225,6 +223,8 @@ void InspectorController::connectFrontend(InspectorFrontendChannel* frontendChan for (Agents::iterator it = m_agents.begin(); it != m_agents.end(); ++it) (*it)->setFrontend(frontend); + if (!InspectorInstrumentation::hasFrontends()) + ScriptController::setCaptureCallStackForUncaughtExceptions(true); InspectorInstrumentation::frontendCreated(); ASSERT(m_inspectorClient); @@ -252,6 +252,8 @@ void InspectorController::disconnectFrontend() m_inspectorFrontend.clear(); InspectorInstrumentation::frontendDeleted(); + if (!InspectorInstrumentation::hasFrontends()) + ScriptController::setCaptureCallStackForUncaughtExceptions(false); } void InspectorController::show() @@ -291,11 +293,6 @@ void InspectorController::setProcessId(long processId) IdentifiersFactory::setProcessId(processId); } -void InspectorController::webViewResized(const IntSize& size) -{ - m_overlay->resize(size); -} - void InspectorController::evaluateForTestInFrontend(long callId, const String& script) { m_inspectorAgent->evaluateForTestInFrontend(callId, script); @@ -382,32 +379,6 @@ void InspectorController::setResourcesDataSizeLimitsFromInternals(int maximumRes m_resourceAgent->setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize); } -void InspectorController::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const -{ - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorController); - info.addMember(m_inspectorAgent); - info.addMember(m_instrumentingAgents); - info.addMember(m_injectedScriptManager); - info.addMember(m_state); - info.addMember(m_overlay); - - info.addMember(m_inspectorAgent); - info.addMember(m_domAgent); - info.addMember(m_resourceAgent); - info.addMember(m_pageAgent); -#if ENABLE(JAVASCRIPT_DEBUGGER) - info.addMember(m_debuggerAgent); - info.addMember(m_profilerAgent); -#endif - - info.addMember(m_inspectorBackendDispatcher); - info.addMember(m_inspectorFrontendClient); - info.addMember(m_inspectorFrontend); - info.addMember(m_page); - info.addMember(m_inspectorClient); - info.addMember(m_agents); -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h index 2e89092e2..0331e13d5 100644 --- a/Source/WebCore/inspector/InspectorController.h +++ b/Source/WebCore/inspector/InspectorController.h @@ -58,7 +58,6 @@ class InspectorProfilerAgent; class InspectorResourceAgent; class InspectorState; class InstrumentingAgents; -class IntSize; class Page; class PostWorkerNotificationToFrontendTask; class Node; @@ -92,7 +91,6 @@ public: void disconnectFrontend(); void reconnectFrontend(InspectorFrontendChannel*, const String& inspectorStateCookie); void setProcessId(long); - void webViewResized(const IntSize&); void inspect(Node*); void drawHighlight(GraphicsContext&) const; @@ -114,8 +112,6 @@ public: InspectorClient* inspectorClient() const { return m_inspectorClient; } InspectorPageAgent* pageAgent() const { return m_pageAgent; } - void reportMemoryUsage(MemoryObjectInfo*) const; - private: InspectorController(Page*, InspectorClient*); diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp index da149be02..a533e5253 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp @@ -470,7 +470,7 @@ Node* InspectorDOMAgent::nodeForId(int id) HashMap<int, Node*>::iterator it = m_idToNode.find(id); if (it != m_idToNode.end()) - return it->value; + return it->second; return 0; } @@ -916,9 +916,9 @@ void InspectorDOMAgent::performSearch(ErrorString*, const String& whitespaceTrim SearchResults::iterator resultsIt = m_searchResults.add(*searchId, Vector<RefPtr<Node> >()).iterator; for (ListHashSet<Node*>::iterator it = resultCollector.begin(); it != resultCollector.end(); ++it) - resultsIt->value.append(*it); + resultsIt->second.append(*it); - *resultCount = resultsIt->value.size(); + *resultCount = resultsIt->second.size(); } void InspectorDOMAgent::getSearchResults(ErrorString* errorString, const String& searchId, int fromIndex, int toIndex, RefPtr<TypeBuilder::Array<int> >& nodeIds) @@ -929,7 +929,7 @@ void InspectorDOMAgent::getSearchResults(ErrorString* errorString, const String& return; } - int size = it->value.size(); + int size = it->second.size(); if (fromIndex < 0 || toIndex > size || fromIndex >= toIndex) { *errorString = "Invalid search result range"; return; @@ -937,7 +937,7 @@ void InspectorDOMAgent::getSearchResults(ErrorString* errorString, const String& nodeIds = TypeBuilder::Array<int>::create(); for (int i = fromIndex; i < toIndex; ++i) - nodeIds->addItem(pushNodePathToFrontend((it->value)[i].get())); + nodeIds->addItem(pushNodePathToFrontend((it->second)[i].get())); } void InspectorDOMAgent::discardSearchResults(ErrorString*, const String& searchId) @@ -957,22 +957,9 @@ bool InspectorDOMAgent::handleMousePress() return false; } -bool InspectorDOMAgent::handleTouchEvent(Node* node) -{ - if (!m_searchingForNode) - return false; - if (node && m_inspectModeHighlightConfig) { - m_overlay->highlightNode(node, *m_inspectModeHighlightConfig); - inspect(node); - return true; - } - return false; -} - -void InspectorDOMAgent::inspect(Node* inspectedNode) +void InspectorDOMAgent::inspect(Node* node) { ErrorString error; - RefPtr<Node> node = inspectedNode; setSearchingForNode(&error, false, 0); if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE) diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h index 3b7265283..2f61a0a74 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.h +++ b/Source/WebCore/inspector/InspectorDOMAgent.h @@ -177,7 +177,6 @@ public: PassRefPtr<TypeBuilder::Runtime::RemoteObject> resolveNode(Node*, const String& objectGroup); bool handleMousePress(); - bool handleTouchEvent(Node*); void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); void inspect(Node*); void focusNode(); diff --git a/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp index c4fcb82b7..8032295d8 100644 --- a/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp @@ -402,8 +402,8 @@ void InspectorDOMDebuggerAgent::willSendXMLHttpRequest(const String& url) else { RefPtr<InspectorObject> xhrBreakpoints = m_state->getObject(DOMDebuggerAgentState::xhrBreakpoints); for (InspectorObject::iterator it = xhrBreakpoints->begin(); it != xhrBreakpoints->end(); ++it) { - if (url.contains(it->key)) { - breakpointURL = it->key; + if (url.contains(it->first)) { + breakpointURL = it->first; break; } } diff --git a/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp b/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp index ebdf1f395..90a0a9e60 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp @@ -45,9 +45,7 @@ #include "Storage.h" #include "StorageArea.h" #include "VoidCallback.h" -#include "WebCoreMemoryInstrumentation.h" -#include <wtf/MemoryInstrumentationHashMap.h> #include <wtf/Vector.h> namespace WebCore { @@ -79,7 +77,7 @@ void InspectorDOMStorageAgent::clearFrontend() { DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end(); for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it) - it->value->unbind(); + it->second->unbind(); m_frontend = 0; disable(0); } @@ -98,7 +96,7 @@ void InspectorDOMStorageAgent::enable(ErrorString*) DOMStorageResourcesMap::iterator resourcesEnd = m_resources.end(); for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) - it->value->bind(m_frontend); + it->second->bind(m_frontend); } void InspectorDOMStorageAgent::disable(ErrorString*) @@ -167,8 +165,8 @@ String InspectorDOMStorageAgent::storageId(SecurityOrigin* securityOrigin, bool ASSERT(securityOrigin); DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end(); for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it) { - if (it->value->isSameOriginAndType(securityOrigin, isLocalStorage)) - return it->key; + if (it->second->isSameOriginAndType(securityOrigin, isLocalStorage)) + return it->first; } return String(); } @@ -178,14 +176,14 @@ InspectorDOMStorageResource* InspectorDOMStorageAgent::getDOMStorageResourceForI DOMStorageResourcesMap::iterator it = m_resources.find(storageId); if (it == m_resources.end()) return 0; - return it->value.get(); + return it->second.get(); } void InspectorDOMStorageAgent::didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame) { DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end(); for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it) { - if (it->value->isSameOriginAndType(frame->document()->securityOrigin(), isLocalStorage)) + if (it->second->isSameOriginAndType(frame->document()->securityOrigin(), isLocalStorage)) return; } @@ -216,14 +214,15 @@ void InspectorDOMStorageAgent::clearResources() m_resources.clear(); } -void InspectorDOMStorageAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +size_t InspectorDOMStorageAgent::memoryBytesUsedByStorageCache() const { - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorDOMStorageAgent); - InspectorBaseAgent<InspectorDOMStorageAgent>::reportMemoryUsage(memoryObjectInfo); - info.addMember(m_resources); - info.addMember(m_frontend); + size_t size = 0; + for (DOMStorageResourcesMap::const_iterator it = m_resources.begin(); it != m_resources.end(); ++it) + size += it->second->storageArea()->memoryBytesUsedByCache(); + return size; } + } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorDOMStorageAgent.h b/Source/WebCore/inspector/InspectorDOMStorageAgent.h index 1822c6ab0..a4f87b0e6 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageAgent.h +++ b/Source/WebCore/inspector/InspectorDOMStorageAgent.h @@ -78,7 +78,8 @@ public: void didUseDOMStorage(StorageArea*, bool isLocalStorage, Frame*); void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*); - virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; + // Called from InspectorMemoryAgent + size_t memoryBytesUsedByStorageCache() const; private: InspectorDOMStorageAgent(InstrumentingAgents*, InspectorState*); diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp index 029e39228..f7a8368fd 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp +++ b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp @@ -85,16 +85,6 @@ void InspectorDOMStorageResource::unbind() m_frontend = 0; } -void InspectorDOMStorageResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const -{ - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorDOMStorageResources); - info.addMember(m_storageArea); - info.addMember(m_frame); - info.addMember(m_frontend); - info.addMember(m_id); - info.addPrivateBuffer(m_storageArea->memoryBytesUsedByCache()); -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.h b/Source/WebCore/inspector/InspectorDOMStorageResource.h index 10d46d750..ac059cba8 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageResource.h +++ b/Source/WebCore/inspector/InspectorDOMStorageResource.h @@ -58,8 +58,6 @@ public: StorageArea* storageArea() const { return m_storageArea.get(); } Frame* frame() const { return m_frame.get(); } - void reportMemoryUsage(MemoryObjectInfo*) const; - private: InspectorDOMStorageResource(StorageArea*, bool isLocalStorage, Frame*); diff --git a/Source/WebCore/inspector/InspectorDatabaseAgent.cpp b/Source/WebCore/inspector/InspectorDatabaseAgent.cpp index 0c20a3c7c..1099c4059 100644 --- a/Source/WebCore/inspector/InspectorDatabaseAgent.cpp +++ b/Source/WebCore/inspector/InspectorDatabaseAgent.cpp @@ -245,7 +245,7 @@ void InspectorDatabaseAgent::enable(ErrorString*) DatabaseResourcesMap::iterator databasesEnd = m_resources.end(); for (DatabaseResourcesMap::iterator it = m_resources.begin(); it != databasesEnd; ++it) - it->value->bind(m_frontend); + it->second->bind(m_frontend); } void InspectorDatabaseAgent::disable(ErrorString*) @@ -303,8 +303,8 @@ void InspectorDatabaseAgent::executeSQL(ErrorString*, const String& databaseId, String InspectorDatabaseAgent::databaseId(Database* database) { for (DatabaseResourcesMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) { - if (it->value->database() == database) - return it->key; + if (it->second->database() == database) + return it->first; } return String(); } @@ -312,8 +312,8 @@ String InspectorDatabaseAgent::databaseId(Database* database) InspectorDatabaseResource* InspectorDatabaseAgent::findByFileName(const String& fileName) { for (DatabaseResourcesMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) { - if (it->value->database()->fileName() == fileName) - return it->value.get(); + if (it->second->database()->fileName() == fileName) + return it->second.get(); } return 0; } @@ -323,7 +323,7 @@ Database* InspectorDatabaseAgent::databaseForId(const String& databaseId) DatabaseResourcesMap::iterator it = m_resources.find(databaseId); if (it == m_resources.end()) return 0; - return it->value->database(); + return it->second->database(); } } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp index a77c06fb5..aa047c914 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp @@ -248,9 +248,9 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int li ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++it) { - if (!matches(it->value.url, url, isRegex)) + if (!matches(it->second.url, url, isRegex)) continue; - RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(breakpointId, it->key, breakpoint); + RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(breakpointId, it->first, breakpoint); if (location) locations->addItem(location); } @@ -302,8 +302,8 @@ void InspectorDebuggerAgent::removeBreakpoint(ErrorString*, const String& breakp BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIdsIterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId); if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpointIds.end()) return; - for (size_t i = 0; i < debugServerBreakpointIdsIterator->value.size(); ++i) - scriptDebugServer().removeBreakpoint(debugServerBreakpointIdsIterator->value[i]); + for (size_t i = 0; i < debugServerBreakpointIdsIterator->second.size(); ++i) + scriptDebugServer().removeBreakpoint(debugServerBreakpointIdsIterator->second[i]); m_breakpointIdToDebugServerBreakpointIds.remove(debugServerBreakpointIdsIterator); } @@ -331,7 +331,7 @@ PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreak ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); if (scriptIterator == m_scripts.end()) return 0; - Script& script = scriptIterator->value; + Script& script = scriptIterator->second; if (breakpoint.lineNumber < script.startLine || script.endLine < breakpoint.lineNumber) return 0; @@ -344,7 +344,7 @@ PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreak BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIdsIterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId); if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpointIds.end()) debugServerBreakpointIdsIterator = m_breakpointIdToDebugServerBreakpointIds.set(breakpointId, Vector<String>()).iterator; - debugServerBreakpointIdsIterator->value.append(debugServerBreakpointId); + debugServerBreakpointIdsIterator->second.append(debugServerBreakpointId); RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Location::create() .setScriptId(scriptId) @@ -370,7 +370,7 @@ void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& s ScriptsMap::iterator it = m_scripts.find(scriptId); if (it != m_scripts.end()) - results = ContentSearchUtils::searchInTextByLines(it->value.source, query, caseSensitive, isRegex); + results = ContentSearchUtils::searchInTextByLines(it->second.source, query, caseSensitive, isRegex); else *error = "No script for id: " + scriptId; } @@ -403,7 +403,7 @@ void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s { ScriptsMap::iterator it = m_scripts.find(scriptId); if (it != m_scripts.end()) - *scriptSource = it->value.source; + *scriptSource = it->second.source; else *error = "No script for id: " + scriptId; } @@ -630,35 +630,29 @@ void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script const bool* isContentScript = script.isContentScript ? &script.isContentScript : 0; String sourceMapURL = sourceMapURLForScript(script); String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL; - String sourceURL; - if (!script.startLine && !script.startColumn) - sourceURL = ContentSearchUtils::findSourceURL(script.source); - bool hasSourceURL = !sourceURL.isEmpty(); - String scriptURL = hasSourceURL ? sourceURL : script.url; - bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0; - m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, hasSourceURLParam); + m_frontend->scriptParsed(scriptId, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceMapURLParam); m_scripts.set(scriptId, script); - if (scriptURL.isEmpty()) + if (script.url.isEmpty()) return; RefPtr<InspectorObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); for (InspectorObject::iterator it = breakpointsCookie->begin(); it != breakpointsCookie->end(); ++it) { - RefPtr<InspectorObject> breakpointObject = it->value->asObject(); + RefPtr<InspectorObject> breakpointObject = it->second->asObject(); bool isRegex; breakpointObject->getBoolean("isRegex", &isRegex); String url; breakpointObject->getString("url", &url); - if (!matches(scriptURL, url, isRegex)) + if (!matches(script.url, url, isRegex)) continue; ScriptBreakpoint breakpoint; breakpointObject->getNumber("lineNumber", &breakpoint.lineNumber); breakpointObject->getNumber("columnNumber", &breakpoint.columnNumber); breakpointObject->getString("condition", &breakpoint.condition); - RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it->key, scriptId, breakpoint); + RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it->first, scriptId, breakpoint); if (location) - m_frontend->breakpointResolved(it->key, location); + m_frontend->breakpointResolved(it->first, location); } } diff --git a/Source/WebCore/inspector/InspectorFrontendHost.idl b/Source/WebCore/inspector/InspectorFrontendHost.idl index 8ddc9a6fd..9f4b40d8b 100644 --- a/Source/WebCore/inspector/InspectorFrontendHost.idl +++ b/Source/WebCore/inspector/InspectorFrontendHost.idl @@ -30,41 +30,43 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=INSPECTOR -] interface InspectorFrontendHost { - void loaded(); - void closeWindow(); - void bringToFront(); - void setZoomFactor(in float zoom); - void inspectedURLChanged(in DOMString newURL); +module core { + interface [ + Conditional=INSPECTOR + ] InspectorFrontendHost { + void loaded(); + void closeWindow(); + void bringToFront(); + void setZoomFactor(in float zoom); + void inspectedURLChanged(in DOMString newURL); - void requestAttachWindow(); - void requestDetachWindow(); - void requestSetDockSide(in DOMString side); - void setAttachedWindowHeight(in unsigned long height); - void moveWindowBy(in float x, in float y); - void setInjectedScriptForOrigin(in DOMString origin, in DOMString script); + void requestAttachWindow(); + void requestDetachWindow(); + void requestSetDockSide(in DOMString side); + void setAttachedWindowHeight(in unsigned long height); + void moveWindowBy(in float x, in float y); + void setInjectedScriptForOrigin(in DOMString origin, in DOMString script); - DOMString localizedStringsURL(); - DOMString hiddenPanels(); + DOMString localizedStringsURL(); + DOMString hiddenPanels(); - void copyText(in DOMString text); - void openInNewTab(in DOMString url); - boolean canSave(); - void save(in DOMString url, in DOMString content, in boolean forceSaveAs); - void append(in DOMString url, in DOMString content); + void copyText(in DOMString text); + void openInNewTab(in DOMString url); + boolean canSave(); + void save(in DOMString url, in DOMString content, in boolean forceSaveAs); + void append(in DOMString url, in DOMString content); - boolean canInspectWorkers(); + boolean canInspectWorkers(); - [Custom] DOMString platform(); - [Custom] DOMString port(); - [Custom] void showContextMenu(in MouseEvent event, in DOMObject items); - void sendMessageToBackend(in DOMString message); + [Custom] DOMString platform(); + [Custom] DOMString port(); + [Custom] void showContextMenu(in MouseEvent event, in DOMObject items); + void sendMessageToBackend(in DOMString message); - [Custom] void recordActionTaken(in unsigned long actionCode); - [Custom] void recordPanelShown(in unsigned long panelCode); - [Custom] void recordSettingChanged(in unsigned long settingChanged); - - DOMString loadResourceSynchronously(in DOMString url); -}; + [Custom] void recordActionTaken(in unsigned long actionCode); + [Custom] void recordPanelShown(in unsigned long panelCode); + [Custom] void recordSettingChanged(in unsigned long settingChanged); + + DOMString loadResourceSynchronously(in DOMString url); + }; +} diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp index 194d7a573..f12bd0dac 100644 --- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp +++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp @@ -305,12 +305,12 @@ public: RefPtr<TypeBuilder::Array<TypeBuilder::IndexedDB::ObjectStore> > objectStores = TypeBuilder::Array<TypeBuilder::IndexedDB::ObjectStore>::create(); for (IDBDatabaseMetadata::ObjectStoreMap::const_iterator it = databaseMetadata.objectStores.begin(); it != databaseMetadata.objectStores.end(); ++it) { - const IDBObjectStoreMetadata& objectStoreMetadata = it->value; + const IDBObjectStoreMetadata& objectStoreMetadata = it->second; RefPtr<TypeBuilder::Array<TypeBuilder::IndexedDB::ObjectStoreIndex> > indexes = TypeBuilder::Array<TypeBuilder::IndexedDB::ObjectStoreIndex>::create(); for (IDBObjectStoreMetadata::IndexMap::const_iterator it = objectStoreMetadata.indexes.begin(); it != objectStoreMetadata.indexes.end(); ++it) { - const IDBIndexMetadata& indexMetadata = it->value; + const IDBIndexMetadata& indexMetadata = it->second; RefPtr<ObjectStoreIndex> objectStoreIndex = ObjectStoreIndex::create() .setName(indexMetadata.name) @@ -329,7 +329,6 @@ public: } RefPtr<DatabaseWithObjectStores> result = DatabaseWithObjectStores::create() .setName(databaseMetadata.name) - .setIntVersion(databaseMetadata.intVersion) .setVersion(databaseMetadata.version) .setObjectStores(objectStores); diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index 81dded3e0..eb06071e4 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -46,7 +46,6 @@ #include "InspectorApplicationCacheAgent.h" #include "InspectorDOMDebuggerAgent.h" #include "InspectorCSSAgent.h" -#include "InspectorCanvasAgent.h" #include "InspectorConsoleAgent.h" #include "InspectorController.h" #include "WorkerInspectorController.h" @@ -262,13 +261,6 @@ void InspectorInstrumentation::didScrollImpl(InstrumentingAgents* instrumentingA pageAgent->didScroll(); } -bool InspectorInstrumentation::handleTouchEventImpl(InstrumentingAgents* instrumentingAgents, Node* node) -{ - if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent()) - return domAgent->handleTouchEvent(node); - return false; -} - bool InspectorInstrumentation::handleMousePressImpl(InstrumentingAgents* instrumentingAgents) { if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent()) @@ -753,7 +745,7 @@ void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrum double finishTime = 0.0; // FIXME: Expose all of the timing details to inspector and have it calculate finishTime. if (monotonicFinishTime) - finishTime = loader->timing()->monotonicTimeToPseudoWallTime(monotonicFinishTime); + finishTime = loader->timing()->convertMonotonicTimeToDocumentTime(monotonicFinishTime); if (timelineAgent) timelineAgent->didFinishLoadingResource(identifier, false, finishTime, loader->frame()); @@ -1142,30 +1134,23 @@ bool InspectorInstrumentation::collectingHTMLParseErrors(InstrumentingAgents* in return false; } -bool InspectorInstrumentation::canvasAgentEnabled(ScriptExecutionContext* scriptExecutionContext) +bool InspectorInstrumentation::hasFrontendForScriptContext(ScriptExecutionContext* scriptExecutionContext) { - InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(scriptExecutionContext); - return instrumentingAgents && instrumentingAgents->inspectorCanvasAgent(); -} + if (!scriptExecutionContext) + return false; -bool InspectorInstrumentation::consoleAgentEnabled(ScriptExecutionContext* scriptExecutionContext) -{ - InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(scriptExecutionContext); - InspectorConsoleAgent* consoleAgent = instrumentingAgents ? instrumentingAgents->inspectorConsoleAgent() : 0; - return consoleAgent && consoleAgent->enabled(); -} - -bool InspectorInstrumentation::runtimeAgentEnabled(Frame* frame) -{ - InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame); - InspectorRuntimeAgent* runtimeAgent = instrumentingAgents ? instrumentingAgents->inspectorRuntimeAgent() : 0; - return runtimeAgent && runtimeAgent->enabled(); -} +#if ENABLE(WORKERS) + if (scriptExecutionContext->isWorkerContext()) { + WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext); + WorkerInspectorController* workerInspectorController = workerContext->workerInspectorController(); + return workerInspectorController && workerInspectorController->hasFrontend(); + } +#endif -bool InspectorInstrumentation::timelineAgentEnabled(ScriptExecutionContext* scriptExecutionContext) -{ - InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(scriptExecutionContext); - return instrumentingAgents && instrumentingAgents->inspectorTimelineAgent(); + ASSERT(scriptExecutionContext->isDocument()); + Document* document = static_cast<Document*>(scriptExecutionContext); + Page* page = document->page(); + return page && page->inspectorController()->hasFrontend(); } void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InstrumentingAgents* instrumentingAgents, bool isDOMEvent, const String& eventName, bool synchronous) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 4588865c6..400c443b8 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -37,9 +37,14 @@ #include "Frame.h" #include "Page.h" #include "ScriptExecutionContext.h" -#include "ScriptState.h" #include "StorageArea.h" +#if USE(JSC) +namespace JSC { +class ExecState; +} +#endif + namespace WebCore { class CSSRule; @@ -77,6 +82,12 @@ class WorkerContext; class WorkerContextProxy; class XMLHttpRequest; +#if USE(JSC) +typedef JSC::ExecState ScriptState; +#else +class ScriptState; +#endif + #if ENABLE(WEB_SOCKETS) struct WebSocketFrame; class WebSocketHandshakeRequest; @@ -110,7 +121,6 @@ public: static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags); static bool handleMousePress(Page*); - static bool handleTouchEvent(Page*, Node*); static bool forcePseudoState(Element*, CSSSelector::PseudoType); static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url); @@ -253,17 +263,11 @@ public: static void frontendCreated() { s_frontendCounter += 1; } static void frontendDeleted() { s_frontendCounter -= 1; } static bool hasFrontends() { return s_frontendCounter; } - static bool canvasAgentEnabled(ScriptExecutionContext*); - static bool consoleAgentEnabled(ScriptExecutionContext*); - static bool runtimeAgentEnabled(Frame*); - static bool timelineAgentEnabled(ScriptExecutionContext*); + static bool hasFrontendForScriptContext(ScriptExecutionContext*); static bool collectingHTMLParseErrors(Page*); #else static bool hasFrontends() { return false; } - static bool canvasAgentEnabled(ScriptExecutionContext*) { return false; } - static bool consoleAgentEnabled(ScriptExecutionContext*) { return false; } - static bool runtimeAgentEnabled(Frame*) { return false; } - static bool timelineAgentEnabled(ScriptExecutionContext*) { return false; } + static bool hasFrontendForScriptContext(ScriptExecutionContext*) { return false; } static bool collectingHTMLParseErrors(Page*) { return false; } #endif @@ -299,7 +303,6 @@ private: static void didUpdateRegionLayoutImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*); static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags); - static bool handleTouchEventImpl(InstrumentingAgents*, Node*); static bool handleMousePressImpl(InstrumentingAgents*); static bool forcePseudoStateImpl(InstrumentingAgents*, Element*, CSSSelector::PseudoType); @@ -607,16 +610,6 @@ inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const #endif } -inline bool InspectorInstrumentation::handleTouchEvent(Page* page, Node* node) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(false); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - return handleTouchEventImpl(instrumentingAgents, node); -#endif - return false; -} - inline bool InspectorInstrumentation::handleMousePress(Page* page) { #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorMemoryAgent.cpp b/Source/WebCore/inspector/InspectorMemoryAgent.cpp index badcb795b..2cef9ad56 100644 --- a/Source/WebCore/inspector/InspectorMemoryAgent.cpp +++ b/Source/WebCore/inspector/InspectorMemoryAgent.cpp @@ -39,7 +39,6 @@ #include "Document.h" #include "EventListenerMap.h" #include "Frame.h" -#include "InspectorClient.h" #include "InspectorDOMStorageAgent.h" #include "InspectorFrontend.h" #include "InspectorState.h" @@ -53,10 +52,9 @@ #include "ScriptGCEvent.h" #include "ScriptProfiler.h" #include "StyledElement.h" +#include <wtf/ArrayBuffer.h> #include <wtf/ArrayBufferView.h> #include <wtf/HashSet.h> -#include <wtf/MemoryInstrumentationArrayBufferView.h> -#include <wtf/NonCopyingSort.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> @@ -71,87 +69,27 @@ using WebCore::TypeBuilder::Memory::StringStatistics; // Use a type alias instead of 'using' here which would cause a conflict on Mac. typedef WebCore::TypeBuilder::Memory::MemoryBlock InspectorMemoryBlock; -typedef WebCore::TypeBuilder::Array<InspectorMemoryBlock> InspectorMemoryBlocks; namespace WebCore { -namespace { - -class MemoryUsageStatsGenerator { -public: - MemoryUsageStatsGenerator(MemoryInstrumentationClientImpl* client) : m_client(client) { } - - void dump(InspectorMemoryBlocks* children) - { - m_sizesMap = m_client->sizesMap(); - - Vector<String> objectTypes; - objectTypes.appendRange(m_sizesMap.keys().begin(), m_sizesMap.keys().end()); - - for (Vector<String>::const_iterator i = objectTypes.begin(); i != objectTypes.end(); ++i) - updateParentSizes(*i, m_sizesMap.get(*i)); - - objectTypes.clear(); - objectTypes.appendRange(m_sizesMap.keys().begin(), m_sizesMap.keys().end()); - nonCopyingSort(objectTypes.begin(), objectTypes.end(), stringCompare); - - size_t index = 0; - while (index < objectTypes.size()) - index = buildObjectForIndex(index, objectTypes, children); - - addMemoryInstrumentationDebugData(children); - } - -private: - static bool stringCompare(const String& a, const String& b) { return WTF::codePointCompare(a, b) < 0; } - - void updateParentSizes(String objectType, const size_t size) - { - for (size_t dotPosition = objectType.reverseFind('.'); dotPosition != notFound; dotPosition = objectType.reverseFind('.', dotPosition)) { - objectType = objectType.substring(0, dotPosition); - TypeNameToSizeMap::AddResult result = m_sizesMap.add(objectType, size); - if (!result.isNewEntry) - result.iterator->value += size; - } - } - - size_t buildObjectForIndex(size_t index, const Vector<String>& objectTypes, InspectorMemoryBlocks* array) - { - String typeName = objectTypes[index]; - RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName(typeName); - block->setSize(m_sizesMap.get(typeName)); - String prefix = typeName; - prefix.append('.'); - array->addItem(block); - ++index; - RefPtr<InspectorMemoryBlocks> children; - while (index < objectTypes.size() && objectTypes[index].startsWith(prefix)) { - if (!children) - children = InspectorMemoryBlocks::create(); - index = buildObjectForIndex(index, objectTypes, children.get()); - } - if (children) - block->setChildren(children.release()); - return index; - } - - void addMemoryInstrumentationDebugData(InspectorMemoryBlocks* children) - { - if (m_client->checkInstrumentedObjects()) { - RefPtr<InspectorMemoryBlock> totalInstrumented = InspectorMemoryBlock::create().setName("InstrumentedObjectsCount"); - totalInstrumented->setSize(m_client->totalCountedObjects()); - - RefPtr<InspectorMemoryBlock> incorrectlyInstrumented = InspectorMemoryBlock::create().setName("InstrumentedButNotAllocatedObjectsCount"); - incorrectlyInstrumented->setSize(m_client->totalObjectsNotInAllocatedSet()); - - children->addItem(totalInstrumented); - children->addItem(incorrectlyInstrumented); - } - } +namespace MemoryBlockName { +static const char jsHeapAllocated[] = "JSHeapAllocated"; +static const char jsHeapUsed[] = "JSHeapUsed"; +static const char jsExternalResources[] = "JSExternalResources"; +static const char jsExternalArrays[] = "JSExternalArrays"; +static const char jsExternalStrings[] = "JSExternalStrings"; +static const char inspectorData[] = "InspectorData"; +static const char inspectorDOMData[] = "InspectorDOMData"; +static const char inspectorJSHeapData[] = "InspectorJSHeapData"; +static const char processPrivateMemory[] = "ProcessPrivateMemory"; + +static const char renderTreeUsed[] = "RenderTreeUsed"; +static const char renderTreeAllocated[] = "RenderTreeAllocated"; + +static const char domStorageCache[] = "DOMStorageCache"; +} - MemoryInstrumentationClientImpl* m_client; - TypeNameToSizeMap m_sizesMap; -}; +namespace { String nodeName(Node* node) { @@ -206,8 +144,8 @@ public: { RefPtr<TypeBuilder::Array<TypeBuilder::Memory::NodeCount> > childrenStats = TypeBuilder::Array<TypeBuilder::Memory::NodeCount>::create(); for (HashMap<String, int>::iterator it = m_nodeNameToCount.begin(); it != m_nodeNameToCount.end(); ++it) { - RefPtr<NodeCount> nodeCount = NodeCount::create().setNodeName(it->key) - .setCount(it->value); + RefPtr<NodeCount> nodeCount = NodeCount::create().setNodeName(it->first) + .setCount(it->second); childrenStats->addItem(nodeCount); } return childrenStats.release(); @@ -217,8 +155,8 @@ public: { RefPtr<TypeBuilder::Array<TypeBuilder::Memory::ListenerCount> > listenerStats = TypeBuilder::Array<TypeBuilder::Memory::ListenerCount>::create(); for (HashMap<AtomicString, int>::iterator it = m_eventTypeToCount.begin(); it != m_eventTypeToCount.end(); ++it) { - RefPtr<ListenerCount> listenerCount = ListenerCount::create().setType(it->key) - .setCount(it->value); + RefPtr<ListenerCount> listenerCount = ListenerCount::create().setType(it->first) + .setCount(it->second); listenerStats->addItem(listenerCount); } return listenerStats.release(); @@ -366,46 +304,65 @@ private: int m_sharedStringSize; }; -class ExternalStringsRoot : public ExternalStringVisitor { +class ExternalResourceVisitor : public ExternalStringVisitor, public ExternalArrayVisitor { public: - ExternalStringsRoot() : m_memoryClassInfo(0) { } + explicit ExternalResourceVisitor(VisitedObjects& visitedObjects) + : m_visitedObjects(visitedObjects) + , m_jsExternalStringSize(0) + , m_externalArraySize(0) + { } - void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const - { - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::ExternalStrings); - m_memoryClassInfo = &info; - ScriptProfiler::visitExternalStrings(const_cast<ExternalStringsRoot*>(this)); - m_memoryClassInfo = 0; - } + size_t externalStringSize() const { return m_jsExternalStringSize; } + size_t externalArraySize() const { return m_externalArraySize; } private: + virtual void visitJSExternalArray(ArrayBufferView* bufferView) + { + ArrayBuffer* buffer = bufferView->buffer().get(); + if (m_visitedObjects.add(buffer).isNewEntry) + m_externalArraySize += buffer->byteLength(); + } virtual void visitJSExternalString(StringImpl* string) { - m_memoryClassInfo->addMember(string); + if (m_visitedObjects.add(string).isNewEntry) + m_jsExternalStringSize += string->sizeInBytes(); } - mutable MemoryClassInfo* m_memoryClassInfo; + VisitedObjects& m_visitedObjects; + size_t m_jsExternalStringSize; + size_t m_externalArraySize; }; -class ExternalArraysRoot : public ExternalArrayVisitor { +class InspectorDataCounter { public: - ExternalArraysRoot() : m_memoryClassInfo(0) { } - - void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + void addComponent(const String& name, size_t size) { - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::ExternalArrays); - m_memoryClassInfo = &info; - ScriptProfiler::visitExternalArrays(const_cast<ExternalArraysRoot*>(this)); - m_memoryClassInfo = 0; + m_components.append(ComponentInfo(name, size)); } -private: - virtual void visitJSExternalArray(ArrayBufferView* arrayBufferView) + PassRefPtr<InspectorMemoryBlock> dumpStatistics() { - m_memoryClassInfo->addMember(arrayBufferView); + size_t totalSize = 0; + RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName(MemoryBlockName::inspectorData); + for (Vector<ComponentInfo>::iterator it = m_components.begin(); it != m_components.end(); ++it) { + RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName(it->m_name); + block->setSize(it->m_size); + totalSize += it->m_size; + } + block->setSize(totalSize); + return block; } - mutable MemoryClassInfo* m_memoryClassInfo; +private: + class ComponentInfo { + public: + ComponentInfo(const String& name, size_t size) : m_name(name), m_size(size) { } + + const String m_name; + size_t m_size; + }; + + Vector<ComponentInfo> m_components; }; } // namespace @@ -431,28 +388,44 @@ void InspectorMemoryAgent::getDOMNodeCount(ErrorString*, RefPtr<TypeBuilder::Arr strings = counterVisitor.strings(); } -static void reportJSHeapInfo(WTF::MemoryInstrumentationClient& memoryInstrumentationClient) +static PassRefPtr<InspectorMemoryBlock> jsHeapInfo() { HeapInfo info; ScriptGCEvent::getHeapSize(info); - memoryInstrumentationClient.countObjectSize(WebCoreMemoryTypes::JSHeapUsed, info.usedJSHeapSize); - memoryInstrumentationClient.countObjectSize(WebCoreMemoryTypes::JSHeapUnused, info.totalJSHeapSize - info.usedJSHeapSize); + RefPtr<InspectorMemoryBlock> jsHeapAllocated = InspectorMemoryBlock::create().setName(MemoryBlockName::jsHeapAllocated); + jsHeapAllocated->setSize(static_cast<int>(info.totalJSHeapSize)); + + RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create(); + RefPtr<InspectorMemoryBlock> jsHeapUsed = InspectorMemoryBlock::create().setName(MemoryBlockName::jsHeapUsed); + jsHeapUsed->setSize(static_cast<int>(info.usedJSHeapSize)); + children->addItem(jsHeapUsed); + + jsHeapAllocated->setChildren(children); + return jsHeapAllocated.release(); } -static void reportRenderTreeInfo(WTF::MemoryInstrumentationClient& memoryInstrumentationClient, Page* page) +static PassRefPtr<InspectorMemoryBlock> renderTreeInfo(Page* page) { ArenaSize arenaSize = page->renderTreeSize(); - memoryInstrumentationClient.countObjectSize(WebCoreMemoryTypes::RenderTreeUsed, arenaSize.treeSize); - memoryInstrumentationClient.countObjectSize(WebCoreMemoryTypes::RenderTreeUnused, arenaSize.allocated - arenaSize.treeSize); + RefPtr<InspectorMemoryBlock> renderTreeAllocated = InspectorMemoryBlock::create().setName(MemoryBlockName::renderTreeAllocated); + renderTreeAllocated->setSize(arenaSize.allocated); + + RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create(); + RefPtr<InspectorMemoryBlock> renderTreeUsed = InspectorMemoryBlock::create().setName(MemoryBlockName::renderTreeUsed); + renderTreeUsed->setSize(arenaSize.treeSize); + children->addItem(renderTreeUsed); + + renderTreeAllocated->setChildren(children); + return renderTreeAllocated.release(); } namespace { class DOMTreesIterator : public NodeWrapperVisitor { public: - DOMTreesIterator(MemoryInstrumentationImpl& memoryInstrumentation, Page* page) + DOMTreesIterator(Page* page, MemoryInstrumentationImpl& memoryInstrumentation) : m_page(page) , m_memoryInstrumentation(memoryInstrumentation) { @@ -481,23 +454,72 @@ public: m_memoryInstrumentation.addRootObject(memoryCache()); } + PassRefPtr<InspectorMemoryBlock> buildObjectForMemoryCache() const + { + size_t totalSize = 0; + + RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create(); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::MemoryCacheStructures); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceRaw); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceCSS); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceFont); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceImage); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceScript); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceSVG); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceShader); + totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceXSLT); + + RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName(WebCoreMemoryTypes::MemoryCache); + block->setSize(totalSize); + block->setChildren(children.release()); + return block.release(); + } + + PassRefPtr<InspectorMemoryBlock> buildObjectForPage() const + { + size_t totalSize = 0; + + RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > domChildren = TypeBuilder::Array<InspectorMemoryBlock>::create(); + totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::DOM); + totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::Image); + totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::CSS); + totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::Binding); + totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::Loader); + + RefPtr<InspectorMemoryBlock> dom = InspectorMemoryBlock::create().setName(WebCoreMemoryTypes::Page); + dom->setSize(totalSize); + dom->setChildren(domChildren.release()); + return dom.release(); + } + + void dumpStatistics(TypeBuilder::Array<InspectorMemoryBlock>* children, InspectorDataCounter* inspectorData) + { + children->addItem(buildObjectForMemoryCache()); + children->addItem(buildObjectForPage()); + + inspectorData->addComponent(MemoryBlockName::inspectorDOMData, m_memoryInstrumentation.selfSize()); + } private: + size_t addMemoryBlockFor(TypeBuilder::Array<InspectorMemoryBlock>* array, MemoryObjectType typeName) const + { + RefPtr<InspectorMemoryBlock> result = InspectorMemoryBlock::create().setName(typeName); + size_t size = m_memoryInstrumentation.totalSize(typeName); + result->setSize(size); + array->addItem(result); + return size; + } + Page* m_page; MemoryInstrumentationImpl& m_memoryInstrumentation; }; } -static void collectDomTreeInfo(MemoryInstrumentationImpl& memoryInstrumentation, Page* page) +static void collectDomTreeInfo(Page* page, VisitedObjects& visitedObjects, TypeBuilder::Array<InspectorMemoryBlock>* children, InspectorDataCounter* inspectorData) { - ExternalStringsRoot stringsRoot; - memoryInstrumentation.addRootObject(stringsRoot); - - ExternalArraysRoot arraysRoot; - memoryInstrumentation.addRootObject(arraysRoot); - - DOMTreesIterator domTreesIterator(memoryInstrumentation, page); + MemoryInstrumentationImpl memoryInstrumentation(visitedObjects); + DOMTreesIterator domTreesIterator(page, memoryInstrumentation); ScriptProfiler::visitNodeWrappers(&domTreesIterator); @@ -511,9 +533,11 @@ static void collectDomTreeInfo(MemoryInstrumentationImpl& memoryInstrumentation, domTreesIterator.visitBindings(); domTreesIterator.visitMemoryCache(); + + domTreesIterator.dumpStatistics(children, inspectorData); } -static void addPlatformComponentsInfo(PassRefPtr<InspectorMemoryBlocks> children) +static void addPlatformComponentsInfo(PassRefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children) { Vector<MemoryUsageSupport::ComponentInfo> components; MemoryUsageSupport::memoryUsageByComponents(components); @@ -524,27 +548,50 @@ static void addPlatformComponentsInfo(PassRefPtr<InspectorMemoryBlocks> children } } -void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<InspectorMemoryBlock>& processMemory) +static PassRefPtr<InspectorMemoryBlock> jsExternalResourcesInfo(VisitedObjects& visitedObjects) { - MemoryInstrumentationClientImpl memoryInstrumentationClient; - m_inspectorClient->getAllocatedObjects(memoryInstrumentationClient.allocatedObjects()); - MemoryInstrumentationImpl memoryInstrumentation(&memoryInstrumentationClient); + ExternalResourceVisitor visitor(visitedObjects); + ScriptProfiler::visitExternalStrings(&visitor); + ScriptProfiler::visitExternalArrays(&visitor); - reportJSHeapInfo(memoryInstrumentationClient); - reportRenderTreeInfo(memoryInstrumentationClient, m_page); - collectDomTreeInfo(memoryInstrumentation, m_page); // FIXME: collect for all pages? + RefPtr<InspectorMemoryBlock> externalResourcesStats = InspectorMemoryBlock::create().setName(MemoryBlockName::jsExternalResources); + externalResourcesStats->setSize(visitor.externalStringSize() + visitor.externalArraySize()); + RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create(); - RefPtr<InspectorMemoryBlocks> children = InspectorMemoryBlocks::create(); - addPlatformComponentsInfo(children); + RefPtr<InspectorMemoryBlock> externalStringStats = InspectorMemoryBlock::create().setName(MemoryBlockName::jsExternalStrings); + externalStringStats->setSize(visitor.externalStringSize()); + children->addItem(externalStringStats); + + RefPtr<InspectorMemoryBlock> externalArrayStats = InspectorMemoryBlock::create().setName(MemoryBlockName::jsExternalArrays); + externalArrayStats->setSize(visitor.externalArraySize()); + children->addItem(externalArrayStats); - memoryInstrumentation.addRootObject(this); - memoryInstrumentation.addRootObject(memoryInstrumentation); - memoryInstrumentation.addRootObject(memoryInstrumentationClient); + return externalResourcesStats.release(); +} - MemoryUsageStatsGenerator statsGenerator(&memoryInstrumentationClient); - statsGenerator.dump(children.get()); +static PassRefPtr<InspectorMemoryBlock> dumpDOMStorageCache(size_t cacheSize) +{ + RefPtr<InspectorMemoryBlock> domStorageCache = InspectorMemoryBlock::create().setName(MemoryBlockName::domStorageCache); + domStorageCache->setSize(cacheSize); + return domStorageCache; +} - processMemory = InspectorMemoryBlock::create().setName(WebCoreMemoryTypes::ProcessPrivateMemory); +void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<InspectorMemoryBlock>& processMemory) +{ + processMemory = InspectorMemoryBlock::create().setName(MemoryBlockName::processPrivateMemory); + + InspectorDataCounter inspectorData; + inspectorData.addComponent(MemoryBlockName::inspectorJSHeapData, ScriptProfiler::profilerSnapshotsSize()); + + VisitedObjects visitedObjects; + RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create(); + children->addItem(jsHeapInfo()); + children->addItem(renderTreeInfo(m_page)); // FIXME: collect for all pages? + children->addItem(jsExternalResourcesInfo(visitedObjects)); + collectDomTreeInfo(m_page, visitedObjects, children.get(), &inspectorData); // FIXME: collect for all pages? + children->addItem(inspectorData.dumpStatistics()); + children->addItem(dumpDOMStorageCache(m_domStorageAgent->memoryBytesUsedByStorageCache())); + addPlatformComponentsInfo(children); processMemory->setChildren(children); size_t privateBytes = 0; @@ -553,18 +600,10 @@ void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<Ins processMemory->setSize(privateBytes); } -void InspectorMemoryAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const -{ - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector); - InspectorBaseAgent<InspectorMemoryAgent>::reportMemoryUsage(memoryObjectInfo); - info.addMember(m_inspectorClient); - info.addMember(m_page); -} - -InspectorMemoryAgent::InspectorMemoryAgent(InstrumentingAgents* instrumentingAgents, InspectorClient* client, InspectorState* state, Page* page) +InspectorMemoryAgent::InspectorMemoryAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page, InspectorDOMStorageAgent* domStorageAgent) : InspectorBaseAgent<InspectorMemoryAgent>("Memory", instrumentingAgents, state) - , m_inspectorClient(client) , m_page(page) + , m_domStorageAgent(domStorageAgent) { } diff --git a/Source/WebCore/inspector/InspectorMemoryAgent.h b/Source/WebCore/inspector/InspectorMemoryAgent.h index 61f11580c..3b648642e 100644 --- a/Source/WebCore/inspector/InspectorMemoryAgent.h +++ b/Source/WebCore/inspector/InspectorMemoryAgent.h @@ -39,7 +39,6 @@ namespace WebCore { -class InspectorClient; class InspectorDOMStorageAgent; class InspectorState; class InstrumentingAgents; @@ -52,22 +51,19 @@ class InspectorMemoryAgent : public InspectorBaseAgent<InspectorMemoryAgent>, pu public: typedef Vector<OwnPtr<InspectorBaseAgentInterface> > InspectorAgents; - static PassOwnPtr<InspectorMemoryAgent> create(InstrumentingAgents* instrumentingAgents, InspectorClient* client, InspectorState* state, Page* page) + static PassOwnPtr<InspectorMemoryAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, Page* page, InspectorDOMStorageAgent* domStorageAgent) { - return adoptPtr(new InspectorMemoryAgent(instrumentingAgents, client, state, page)); + return adoptPtr(new InspectorMemoryAgent(instrumentingAgents, state, page, domStorageAgent)); } virtual ~InspectorMemoryAgent(); virtual void getDOMNodeCount(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Memory::DOMGroup> >& domGroups, RefPtr<TypeBuilder::Memory::StringStatistics>& strings); virtual void getProcessMemoryDistribution(ErrorString*, RefPtr<TypeBuilder::Memory::MemoryBlock>& processMemory); - virtual void reportMemoryUsage(MemoryObjectInfo*) const; - private: - InspectorMemoryAgent(InstrumentingAgents*, InspectorClient*, InspectorState*, Page*); - - InspectorClient* m_inspectorClient; + InspectorMemoryAgent(InstrumentingAgents*, InspectorState*, Page*, InspectorDOMStorageAgent*); Page* m_page; + InspectorDOMStorageAgent* m_domStorageAgent; }; } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorOverlay.cpp b/Source/WebCore/inspector/InspectorOverlay.cpp index 70681413c..7a87b0f0e 100644 --- a/Source/WebCore/inspector/InspectorOverlay.cpp +++ b/Source/WebCore/inspector/InspectorOverlay.cpp @@ -205,18 +205,12 @@ InspectorOverlay::~InspectorOverlay() void InspectorOverlay::paint(GraphicsContext& context) { - if (m_pausedInDebuggerMessage.isNull() && !m_highlightNode && !m_highlightRect && m_size.isEmpty()) + if (m_pausedInDebuggerMessage.isNull() && !m_highlightNode && !m_highlightRect) return; GraphicsContextStateSaver stateSaver(context); FrameView* view = overlayPage()->mainFrame()->view(); ASSERT(!view->needsLayout()); - - context.beginTransparencyLayer(1); - context.setCompositeOperation(CompositeCopy); - view->paint(&context, IntRect(0, 0, view->width(), view->height())); - - context.endTransparencyLayer(); } void InspectorOverlay::drawOutline(GraphicsContext* context, const LayoutRect& rect, const Color& color) @@ -237,12 +231,6 @@ void InspectorOverlay::getHighlight(Highlight* highlight) const buildRectHighlight(m_page, m_highlightRect.get(), m_rectHighlightConfig, highlight); } -void InspectorOverlay::resize(const IntSize& size) -{ - m_size = size; - update(); -} - void InspectorOverlay::setPausedInDebuggerMessage(const String* message) { m_pausedInDebuggerMessage = message ? *message : String(); @@ -277,7 +265,7 @@ Node* InspectorOverlay::highlightedNode() const void InspectorOverlay::update() { - if (!m_highlightNode && !m_highlightRect && m_pausedInDebuggerMessage.isNull() && m_size.isEmpty()) { + if (!m_highlightNode && !m_highlightRect && m_pausedInDebuggerMessage.isNull()) { m_client->hideHighlight(); return; } @@ -287,16 +275,12 @@ void InspectorOverlay::update() return; FrameView* overlayView = overlayPage()->mainFrame()->view(); - IntSize viewportSize = enclosingIntRect(view->visibleContentRect()).size(); - IntSize frameViewFullSize = enclosingIntRect(view->visibleContentRect(true)).size(); - IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size; - overlayView->resize(size); + IntRect visibleRect = enclosingIntRect(view->visibleContentRect()); + overlayView->resize(visibleRect.width(), visibleRect.height()); // Clear canvas and paint things. - reset(viewportSize, m_size.isEmpty() ? IntSize() : frameViewFullSize); + reset(); - // Include scrollbars to avoid masking them by the gutter. - drawGutter(); drawNodeHighlight(); drawRectHighlight(); drawPausedInDebuggerMessage(); @@ -310,7 +294,7 @@ void InspectorOverlay::update() m_client->highlight(); } -static PassRefPtr<InspectorObject> buildObjectForPoint(const FloatPoint& point) +static RefPtr<InspectorObject> buildObjectForPoint(const FloatPoint& point) { RefPtr<InspectorObject> object = InspectorObject::create(); object->setNumber("x", point.x()); @@ -318,7 +302,7 @@ static PassRefPtr<InspectorObject> buildObjectForPoint(const FloatPoint& point) return object.release(); } -static PassRefPtr<InspectorArray> buildArrayForQuad(const FloatQuad& quad) +static RefPtr<InspectorArray> buildArrayForQuad(const FloatQuad& quad) { RefPtr<InspectorArray> array = InspectorArray::create(); array->pushObject(buildObjectForPoint(quad.p1())); @@ -328,7 +312,7 @@ static PassRefPtr<InspectorArray> buildArrayForQuad(const FloatQuad& quad) return array.release(); } -static PassRefPtr<InspectorObject> buildObjectForHighlight(FrameView* mainView, const Highlight& highlight) +static RefPtr<InspectorObject> buildObjectForHighlight(FrameView* mainView, const Highlight& highlight) { RefPtr<InspectorObject> object = InspectorObject::create(); RefPtr<InspectorArray> array = InspectorArray::create(); @@ -353,19 +337,6 @@ static PassRefPtr<InspectorObject> buildObjectForHighlight(FrameView* mainView, return object.release(); } -static PassRefPtr<InspectorObject> buildObjectForSize(const IntSize& size) -{ - RefPtr<InspectorObject> result = InspectorObject::create(); - result->setNumber("width", size.width()); - result->setNumber("height", size.height()); - return result.release(); -} - -void InspectorOverlay::drawGutter() -{ - evaluateInOverlay("drawGutter", ""); -} - void InspectorOverlay::drawNodeHighlight() { if (!m_highlightNode) @@ -474,13 +445,9 @@ Page* InspectorOverlay::overlayPage() return m_overlayPage.get(); } -void InspectorOverlay::reset(const IntSize& viewportSize, const IntSize& frameViewFullSize) +void InspectorOverlay::reset() { - RefPtr<InspectorObject> resetData = InspectorObject::create(); - resetData->setNumber("deviceScaleFactor", m_page->deviceScaleFactor()); - resetData->setObject("viewportSize", buildObjectForSize(viewportSize)); - resetData->setObject("frameViewFullSize", buildObjectForSize(frameViewFullSize)); - evaluateInOverlay("reset", resetData.release()); + evaluateInOverlay("reset", String::number(m_page->deviceScaleFactor())); } void InspectorOverlay::evaluateInOverlay(const String& method, const String& argument) diff --git a/Source/WebCore/inspector/InspectorOverlay.h b/Source/WebCore/inspector/InspectorOverlay.h index 56f83bb7b..31a63051c 100644 --- a/Source/WebCore/inspector/InspectorOverlay.h +++ b/Source/WebCore/inspector/InspectorOverlay.h @@ -100,7 +100,6 @@ public: void paint(GraphicsContext&); void drawOutline(GraphicsContext*, const LayoutRect&, const Color&); void getHighlight(Highlight*) const; - void resize(const IntSize&); void setPausedInDebuggerMessage(const String*); @@ -113,12 +112,11 @@ public: private: InspectorOverlay(Page*, InspectorClient*); - void drawGutter(); void drawNodeHighlight(); void drawRectHighlight(); void drawPausedInDebuggerMessage(); Page* overlayPage(); - void reset(const IntSize& viewportSize, const IntSize& frameViewFullSize); + void reset(); void evaluateInOverlay(const String& method, const String& argument); void evaluateInOverlay(const String& method, PassRefPtr<InspectorValue> argument); @@ -130,7 +128,6 @@ private: OwnPtr<IntRect> m_highlightRect; OwnPtr<Page> m_overlayPage; HighlightConfig m_rectHighlightConfig; - IntSize m_size; }; } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorOverlayPage.html b/Source/WebCore/inspector/InspectorOverlayPage.html index 2fc8bd635..20c421813 100644 --- a/Source/WebCore/inspector/InspectorOverlayPage.html +++ b/Source/WebCore/inspector/InspectorOverlayPage.html @@ -89,24 +89,6 @@ body.platform-linux { #node-id { color: rgb(26, 26, 166); } - -#right-gutter { - display: none; - right: 0; - top: 0; - bottom: 0; - position: absolute; - background-color: darkgray; -} - -#bottom-gutter { - display: none; - left: 0; - right: 0; - bottom: 0; - position: absolute; - background-color: darkgray; -} </style> <script> const lightGridColor = "rgba(0,0,0,0.2)"; @@ -284,41 +266,14 @@ function quadEquals(quad1, quad2) quad1[3].x === quad2[3].x && quad1[3].y === quad2[3].y; } -function drawGutter() -{ - var frameWidth = frameViewFullSize.width; - var frameHeight = frameViewFullSize.height; - - if (!frameWidth || document.body.offsetWidth <= frameWidth) - rightGutter.style.removeProperty("display"); - else { - rightGutter.style.display = "block"; - rightGutter.style.left = frameWidth + "px"; - } - - if (!frameHeight || document.body.offsetHeight <= frameHeight) - bottomGutter.style.removeProperty("display"); - else { - bottomGutter.style.display = "block"; - bottomGutter.style.top = frameHeight + "px"; - } -} - -function reset(resetData) +function reset(deviceScaleFactor) { - var deviceScaleFactor = resetData.deviceScaleFactor; - var viewportSize = resetData.viewportSize; - window.frameViewFullSize = resetData.frameViewFullSize; - window.canvas = document.getElementById("canvas"); window.context = canvas.getContext("2d"); - window.rightGutter = document.getElementById("right-gutter"); - window.bottomGutter = document.getElementById("bottom-gutter"); - - canvas.width = deviceScaleFactor * viewportSize.width; - canvas.height = deviceScaleFactor * viewportSize.height; - canvas.style.width = viewportSize.width + "px"; - canvas.style.height = viewportSize.height + "px"; + canvas.width = deviceScaleFactor * document.body.offsetWidth; + canvas.height = deviceScaleFactor * document.body.offsetHeight; + canvas.style.width = document.body.offsetWidth + "px"; + canvas.style.height = document.body.offsetHeight + "px"; context.scale(deviceScaleFactor, deviceScaleFactor); document.getElementById("paused-in-debugger").style.visibility = "hidden"; @@ -562,7 +517,5 @@ function log(text) <span id="tag-name"></span><span id="node-id"></span><span id="class-name"></span> <span id="node-width"></span><span class="px">px</span><span class="px"> × </span><span id="node-height"></span><span class="px">px</span> </div> -<div id="right-gutter"></div> -<div id="bottom-gutter"></div> <div id="log"></div> </html> diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp index b35f12830..ef39e6f13 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/InspectorPageAgent.cpp @@ -67,10 +67,10 @@ #include "MemoryCache.h" #include "Page.h" #include "RegularExpression.h" -#include "ResourceBuffer.h" #include "ScriptObject.h" #include "SecurityOrigin.h" #include "Settings.h" +#include "SharedBuffer.h" #include "TextEncoding.h" #include "TextResourceDecoder.h" #include "UserGestureIndicator.h" @@ -98,13 +98,13 @@ static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled"; #endif } -static bool decodeBuffer(const char* buffer, unsigned size, const String& textEncodingName, String* result) +static bool decodeSharedBuffer(PassRefPtr<SharedBuffer> buffer, const String& textEncodingName, String* result) { if (buffer) { TextEncoding encoding(textEncodingName); if (!encoding.isValid()) encoding = WindowsLatin1Encoding(); - *result = encoding.decode(buffer, size); + *result = encoding.decode(buffer->data(), buffer->size()); return true; } return false; @@ -166,7 +166,7 @@ bool InspectorPageAgent::cachedResourceContent(CachedResource* cachedResource, S *base64Encoded = !hasTextContent(cachedResource); if (*base64Encoded) { - RefPtr<SharedBuffer> buffer = hasZeroSize ? SharedBuffer::create() : cachedResource->resourceBuffer()->sharedBuffer(); + RefPtr<SharedBuffer> buffer = hasZeroSize ? SharedBuffer::create() : cachedResource->data(); if (!buffer) return false; @@ -189,7 +189,7 @@ bool InspectorPageAgent::cachedResourceContent(CachedResource* cachedResource, S *result = static_cast<CachedScript*>(cachedResource)->script(); return true; case CachedResource::RawResource: { - ResourceBuffer* buffer = cachedResource->resourceBuffer(); + SharedBuffer* buffer = cachedResource->data(); if (!buffer) return false; RefPtr<TextResourceDecoder> decoder = createXHRTextDecoder(cachedResource->response().mimeType(), cachedResource->response().textEncodingName()); @@ -201,37 +201,31 @@ bool InspectorPageAgent::cachedResourceContent(CachedResource* cachedResource, S return true; } default: - ResourceBuffer* buffer = cachedResource->resourceBuffer(); - return decodeBuffer(buffer ? buffer->data() : 0, buffer ? buffer->size() : 0, cachedResource->encoding(), result); + return decodeSharedBuffer(cachedResource->data(), cachedResource->encoding(), result); } } return false; } -bool InspectorPageAgent::mainResourceContent(Frame* frame, bool withBase64Encode, String* result) +static bool mainResourceContent(Frame* frame, bool withBase64Encode, String* result) { - RefPtr<ResourceBuffer> buffer = frame->loader()->documentLoader()->mainResourceData(); + RefPtr<SharedBuffer> buffer = frame->loader()->documentLoader()->mainResourceData(); if (!buffer) return false; String textEncodingName = frame->document()->inputEncoding(); - return InspectorPageAgent::dataContent(buffer->data(), buffer->size(), textEncodingName, withBase64Encode, result); + return InspectorPageAgent::sharedBufferContent(buffer, textEncodingName, withBase64Encode, result); } // static bool InspectorPageAgent::sharedBufferContent(PassRefPtr<SharedBuffer> buffer, const String& textEncodingName, bool withBase64Encode, String* result) { - return dataContent(buffer ? buffer->data() : 0, buffer ? buffer->size() : 0, textEncodingName, withBase64Encode, result); -} - -bool InspectorPageAgent::dataContent(const char* data, unsigned size, const String& textEncodingName, bool withBase64Encode, String* result) -{ if (withBase64Encode) { - *result = base64Encode(data, size); + *result = base64Encode(buffer->data(), buffer->size()); return true; } - return decodeBuffer(data, size, textEncodingName, result); + return decodeSharedBuffer(buffer, textEncodingName, result); } PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* page, InspectorAgent* inspectorAgent, InspectorState* state, InjectedScriptManager* injectedScriptManager, InspectorClient* client, InspectorOverlay* overlay) @@ -458,7 +452,7 @@ static Vector<CachedResource*> cachedResourcesForFrame(Frame* frame) const CachedResourceLoader::DocumentResourceMap& allResources = frame->document()->cachedResourceLoader()->allCachedResources(); CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end(); for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) { - CachedResource* cachedResource = it->value.get(); + CachedResource* cachedResource = it->second.get(); switch (cachedResource->type()) { case CachedResource::ImageResource: @@ -762,7 +756,7 @@ void InspectorPageAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWor InspectorObject::const_iterator end = scripts->end(); for (InspectorObject::const_iterator it = scripts->begin(); it != end; ++it) { String scriptText; - if (it->value->asString(&scriptText)) + if (it->second->asString(&scriptText)) m_injectedScriptManager->injectScript(scriptText, mainWorldScriptState(frame)); } } @@ -794,8 +788,8 @@ void InspectorPageAgent::frameDetached(Frame* frame) { HashMap<Frame*, String>::iterator iterator = m_frameToIdentifier.find(frame); if (iterator != m_frameToIdentifier.end()) { - m_frontend->frameDetached(iterator->value); - m_identifierToFrame.remove(iterator->value); + m_frontend->frameDetached(iterator->second); + m_identifierToFrame.remove(iterator->second); m_frameToIdentifier.remove(iterator); } } @@ -1108,16 +1102,6 @@ void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabl #endif } -void InspectorPageAgent::setCompositingBordersVisible(ErrorString*, bool visible) -{ - Settings* settings = m_page->settings(); - if (!settings) - return; - - settings->setShowDebugBorders(visible); - settings->setShowRepaintCounter(visible); -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h index 0ce43bef5..7b71b211f 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.h +++ b/Source/WebCore/inspector/InspectorPageAgent.h @@ -118,7 +118,6 @@ public: virtual void clearDeviceOrientationOverride(ErrorString*); virtual void canOverrideDeviceOrientation(ErrorString*, bool*); virtual void setTouchEmulationEnabled(ErrorString*, bool); - virtual void setCompositingBordersVisible(ErrorString*, bool); // Geolocation override helpers. GeolocationPosition* overrideGeolocationPosition(GeolocationPosition*); @@ -161,9 +160,6 @@ private: void updateTouchEventEmulationInPage(bool); #endif - static bool mainResourceContent(Frame*, bool withBase64Encode, String* result); - static bool dataContent(const char* data, unsigned size, const String& textEncodingName, bool withBase64Encode, String* result); - PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(Frame*); PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Frame*); Page* m_page; diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp index 6c28ed231..9c864c5dd 100644 --- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp +++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp @@ -48,9 +48,7 @@ #include "ScriptObject.h" #include "ScriptProfile.h" #include "ScriptProfiler.h" -#include "WebCoreMemoryInstrumentation.h" #include "WorkerScriptDebugServer.h" -#include <wtf/MemoryInstrumentationHashMap.h> #include <wtf/OwnPtr.h> #include <wtf/text/StringConcatenate.h> @@ -258,10 +256,10 @@ void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder: ProfilesMap::iterator profilesEnd = m_profiles.end(); for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it) - headers->addItem(createProfileHeader(*it->value)); + headers->addItem(createProfileHeader(*it->second)); HeapSnapshotsMap::iterator snapshotsEnd = m_snapshots.end(); for (HeapSnapshotsMap::iterator it = m_snapshots.begin(); it != snapshotsEnd; ++it) - headers->addItem(createSnapshotHeader(*it->value)); + headers->addItem(createSnapshotHeader(*it->second)); } namespace { @@ -289,16 +287,16 @@ void InspectorProfilerAgent::getProfile(ErrorString* errorString, const String& return; } profileObject = TypeBuilder::Profiler::Profile::create(); - profileObject->setHead(it->value->buildInspectorObjectForHead()); - if (it->value->bottomUpHead()) - profileObject->setBottomUpHead(it->value->buildInspectorObjectForBottomUpHead()); + profileObject->setHead(it->second->buildInspectorObjectForHead()); + if (it->second->bottomUpHead()) + profileObject->setBottomUpHead(it->second->buildInspectorObjectForBottomUpHead()); } else if (type == HeapProfileType) { HeapSnapshotsMap::iterator it = m_snapshots.find(uid); if (it == m_snapshots.end()) { *errorString = "Profile wasn't found"; return; } - RefPtr<ScriptHeapSnapshot> snapshot = it->value; + RefPtr<ScriptHeapSnapshot> snapshot = it->second; profileObject = TypeBuilder::Profiler::Profile::create(); if (m_frontend) { OutputStream stream(m_frontend, uid); @@ -484,19 +482,6 @@ void InspectorProfilerAgent::getHeapObjectId(ErrorString* errorString, const Str *heapSnapshotObjectId = String::number(id); } -void InspectorProfilerAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const -{ - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorProfilerAgent); - InspectorBaseAgent<InspectorProfilerAgent>::reportMemoryUsage(memoryObjectInfo); - info.addMember(m_consoleAgent); - info.addMember(m_injectedScriptManager); - info.addMember(m_frontend); - info.addMember(m_profiles); - info.addMember(m_snapshots); - - info.addPrivateBuffer(ScriptProfiler::profilerSnapshotsSize()); -} - } // namespace WebCore #endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.h b/Source/WebCore/inspector/InspectorProfilerAgent.h index 823b7e6f0..d548bbfa4 100644 --- a/Source/WebCore/inspector/InspectorProfilerAgent.h +++ b/Source/WebCore/inspector/InspectorProfilerAgent.h @@ -100,8 +100,6 @@ public: virtual void getObjectByHeapObjectId(ErrorString*, const String& heapSnapshotObjectId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>& result); virtual void getHeapObjectId(ErrorString*, const String& objectId, String* heapSnapshotObjectId); - virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; - protected: InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, InspectorState*, InjectedScriptManager*); virtual void startProfiling(const String& title) = 0; diff --git a/Source/WebCore/inspector/InspectorResourceAgent.cpp b/Source/WebCore/inspector/InspectorResourceAgent.cpp index 8d15b8e50..7defb3595 100644 --- a/Source/WebCore/inspector/InspectorResourceAgent.cpp +++ b/Source/WebCore/inspector/InspectorResourceAgent.cpp @@ -54,7 +54,6 @@ #include "NetworkResourcesData.h" #include "Page.h" #include "ProgressTracker.h" -#include "ResourceBuffer.h" #include "ResourceError.h" #include "ResourceLoader.h" #include "ResourceRequest.h" @@ -106,14 +105,14 @@ static PassRefPtr<InspectorObject> buildObjectForHeaders(const HTTPHeaderMap& he RefPtr<InspectorObject> headersObject = InspectorObject::create(); HTTPHeaderMap::const_iterator end = headers.end(); for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it) - headersObject->setString(it->key.string(), it->value); + headersObject->setString(it->first.string(), it->second); return headersObject; } static PassRefPtr<TypeBuilder::Network::ResourceTiming> buildObjectForTiming(const ResourceLoadTiming& timing, DocumentLoader* loader) { return TypeBuilder::Network::ResourceTiming::create() - .setRequestTime(loader->timing()->monotonicTimeToPseudoWallTime(timing.convertResourceLoadTimeToMonotonicTime(0))) + .setRequestTime(timing.convertResourceLoadTimeToDocumentTime(loader->timing(), 0)) .setProxyStart(timing.proxyStart) .setProxyEnd(timing.proxyEnd) .setDnsStart(timing.dnsStart) @@ -217,8 +216,8 @@ void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL InspectorObject::const_iterator end = headers->end(); for (InspectorObject::const_iterator it = headers->begin(); it != end; ++it) { String value; - if (it->value->asString(&value)) - request.setHTTPHeaderField(it->key, value); + if (it->second->asString(&value)) + request.setHTTPHeaderField(it->first, value); } } @@ -303,10 +302,8 @@ void InspectorResourceAgent::didReceiveData(unsigned long identifier, const char void InspectorResourceAgent::didFinishLoading(unsigned long identifier, DocumentLoader* loader, double finishTime) { String requestId = IdentifiersFactory::requestId(identifier); - if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource) { - RefPtr<ResourceBuffer> buffer = loader->frameLoader()->documentLoader()->mainResourceData(); - m_resourcesData->addResourceSharedBuffer(requestId, buffer ? buffer->sharedBuffer() : 0, loader->frame()->document()->inputEncoding()); - } + if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource) + m_resourcesData->addResourceSharedBuffer(requestId, loader->frameLoader()->documentLoader()->mainResourceData(), loader->frame()->document()->inputEncoding()); m_resourcesData->maybeDecodeDataToContent(requestId); @@ -322,10 +319,8 @@ void InspectorResourceAgent::didFailLoading(unsigned long identifier, DocumentLo if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource) { Frame* frame = loader ? loader->frame() : 0; - if (frame && frame->loader()->documentLoader() && frame->document()) { - RefPtr<ResourceBuffer> buffer = frame->loader()->documentLoader()->mainResourceData(); - m_resourcesData->addResourceSharedBuffer(requestId, buffer ? buffer->sharedBuffer() : 0, frame->document()->inputEncoding()); - } + if (frame && frame->loader()->documentLoader() && frame->document()) + m_resourcesData->addResourceSharedBuffer(requestId, frame->loader()->documentLoader()->mainResourceData(), frame->document()->inputEncoding()); } bool canceled = error.isCancellation(); @@ -370,7 +365,7 @@ void InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient(uns if (it == m_pendingXHRReplayData.end()) return; - XHRReplayData* xhrReplayData = it->value.get(); + XHRReplayData* xhrReplayData = it->second.get(); String requestId = IdentifiersFactory::requestId(identifier); m_resourcesData->setXHRReplayData(requestId, xhrReplayData); } @@ -380,7 +375,7 @@ void InspectorResourceAgent::willLoadXHR(ThreadableLoaderClient* client, const S RefPtr<XHRReplayData> xhrReplayData = XHRReplayData::create(method, url, async, formData, includeCredentials); HTTPHeaderMap::const_iterator end = headers.end(); for (HTTPHeaderMap::const_iterator it = headers.begin(); it!= end; ++it) - xhrReplayData->addHeader(it->key, it->value); + xhrReplayData->addHeader(it->first, it->second); m_pendingXHRReplayData.set(client, xhrReplayData); } @@ -629,7 +624,7 @@ void InspectorResourceAgent::replayXHR(ErrorString*, const String& requestId) xhr->open(xhrReplayData->method(), xhrReplayData->url(), xhrReplayData->async(), code); HTTPHeaderMap::const_iterator end = xhrReplayData->headers().end(); for (HTTPHeaderMap::const_iterator it = xhrReplayData->headers().begin(); it!= end; ++it) - xhr->setRequestHeader(it->key, it->value, code); + xhr->setRequestHeader(it->first, it->second, code); xhr->sendFromInspector(xhrReplayData->formData(), code); } diff --git a/Source/WebCore/inspector/InspectorRuntimeAgent.cpp b/Source/WebCore/inspector/InspectorRuntimeAgent.cpp index 80be50c2a..7e4fd4b62 100644 --- a/Source/WebCore/inspector/InspectorRuntimeAgent.cpp +++ b/Source/WebCore/inspector/InspectorRuntimeAgent.cpp @@ -58,7 +58,6 @@ static bool asBool(const bool* const b) InspectorRuntimeAgent::InspectorRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager) : InspectorBaseAgent<InspectorRuntimeAgent>("Runtime", instrumentingAgents, state) - , m_enabled(false) , m_injectedScriptManager(injectedScriptManager) #if ENABLE(JAVASCRIPT_DEBUGGER) , m_scriptDebugServer(0) @@ -136,7 +135,7 @@ void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString, const Strin } } -void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, const bool* const ownProperties, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor> >& result, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >& internalProperties) +void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, const bool* const ownProperties, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor> >& result) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { @@ -150,7 +149,6 @@ void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String muteConsole(); injectedScript.getProperties(errorString, objectId, ownProperties ? *ownProperties : false, &result); - injectedScript.getInternalProperties(errorString, objectId, &internalProperties); unmuteConsole(); #if ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/Source/WebCore/inspector/InspectorRuntimeAgent.h b/Source/WebCore/inspector/InspectorRuntimeAgent.h index 29e57d22f..f8e345e2b 100644 --- a/Source/WebCore/inspector/InspectorRuntimeAgent.h +++ b/Source/WebCore/inspector/InspectorRuntimeAgent.h @@ -57,10 +57,7 @@ class InspectorRuntimeAgent : public InspectorBaseAgent<InspectorRuntimeAgent>, public: virtual ~InspectorRuntimeAgent(); - bool enabled() { return m_enabled; } // Part of the protocol. - virtual void enable(ErrorString*) { m_enabled = true; } - virtual void disable(ErrorString*) { m_enabled = false; } virtual void evaluate(ErrorString*, const String& expression, const String* objectGroup, @@ -79,7 +76,7 @@ public: RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown); virtual void releaseObject(ErrorString*, const String& objectId); - virtual void getProperties(ErrorString*, const String& objectId, const bool* ownProperties, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor> >& result, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >& internalProperties); + virtual void getProperties(ErrorString*, const String& objectId, const bool* ownProperties, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor> >& result); virtual void releaseObjectGroup(ErrorString*, const String& objectGroup); virtual void run(ErrorString*); @@ -98,7 +95,6 @@ protected: virtual void unmuteConsole() = 0; InjectedScriptManager* injectedScriptManager() { return m_injectedScriptManager; } - bool m_enabled; private: InjectedScriptManager* m_injectedScriptManager; diff --git a/Source/WebCore/inspector/InspectorState.cpp b/Source/WebCore/inspector/InspectorState.cpp index baf10c971..70a243984 100644 --- a/Source/WebCore/inspector/InspectorState.cpp +++ b/Source/WebCore/inspector/InspectorState.cpp @@ -80,7 +80,7 @@ bool InspectorState::getBoolean(const String& propertyName) InspectorObject::iterator it = m_properties->find(propertyName); bool value = false; if (it != m_properties->end()) - it->value->asBoolean(&value); + it->second->asBoolean(&value); return value; } @@ -89,7 +89,7 @@ String InspectorState::getString(const String& propertyName) InspectorObject::iterator it = m_properties->find(propertyName); String value; if (it != m_properties->end()) - it->value->asString(&value); + it->second->asString(&value); return value; } @@ -98,7 +98,7 @@ long InspectorState::getLong(const String& propertyName) InspectorObject::iterator it = m_properties->find(propertyName); long value = 0; if (it != m_properties->end()) - it->value->asNumber(&value); + it->second->asNumber(&value); return value; } @@ -107,7 +107,7 @@ double InspectorState::getDouble(const String& propertyName) InspectorObject::iterator it = m_properties->find(propertyName); double value = 0; if (it != m_properties->end()) - it->value->asNumber(&value); + it->second->asNumber(&value); return value; } @@ -118,7 +118,7 @@ PassRefPtr<InspectorObject> InspectorState::getObject(const String& propertyName m_properties->setObject(propertyName, InspectorObject::create()); it = m_properties->find(propertyName); } - return it->value->asObject(); + return it->second->asObject(); } } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp index cc3ccf8e6..5b94de6c1 100644 --- a/Source/WebCore/inspector/InspectorStyleSheet.cpp +++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp @@ -497,8 +497,6 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con RefPtr<Array<TypeBuilder::CSS::ShorthandEntry> > shorthandEntries = Array<TypeBuilder::CSS::ShorthandEntry>::create(); HashMap<String, RefPtr<TypeBuilder::CSS::CSSProperty> > propertyNameToPreviousActiveProperty; HashSet<String> foundShorthands; - String previousPriority; - String previousStatus; for (Vector<InspectorStyleProperty>::iterator it = properties.begin(), itEnd = properties.end(); it != itEnd; ++it) { const CSSPropertySourceData& propertyEntry = it->sourceData; @@ -534,20 +532,11 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con String canonicalPropertyName = propertyId ? getPropertyNameString(propertyId) : name; HashMap<String, RefPtr<TypeBuilder::CSS::CSSProperty> >::iterator activeIt = propertyNameToPreviousActiveProperty.find(canonicalPropertyName); if (activeIt != propertyNameToPreviousActiveProperty.end()) { - if (propertyEntry.parsedOk) { - bool successPriority = activeIt->value->getString(TypeBuilder::CSS::CSSProperty::Priority, &previousPriority); - bool successStatus = activeIt->value->getString(TypeBuilder::CSS::CSSProperty::Status, &previousStatus); - if (successStatus && previousStatus != "inactive") { - if (propertyEntry.important || !successPriority) // Priority not set == "not important". - shouldInactivate = true; - else if (status == TypeBuilder::CSS::CSSProperty::Status::Active) { - // Inactivate a non-important property following the same-named important property. - status = TypeBuilder::CSS::CSSProperty::Status::Inactive; - } - } - } else { + if (propertyEntry.parsedOk) + shouldInactivate = true; + else { bool previousParsedOk; - bool success = activeIt->value->getBoolean(TypeBuilder::CSS::CSSProperty::ParsedOk, &previousParsedOk); + bool success = activeIt->second->getBoolean(TypeBuilder::CSS::CSSProperty::ParsedOk, &previousParsedOk); if (success && !previousParsedOk) shouldInactivate = true; } @@ -555,7 +544,7 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con propertyNameToPreviousActiveProperty.set(canonicalPropertyName, property); if (shouldInactivate) { - activeIt->value->setStatus(TypeBuilder::CSS::CSSProperty::Status::Inactive); + activeIt->second->setStatus(TypeBuilder::CSS::CSSProperty::Status::Inactive); propertyNameToPreviousActiveProperty.set(canonicalPropertyName, property); } } else { @@ -1068,7 +1057,7 @@ PassRefPtr<InspectorStyle> InspectorStyleSheet::inspectorStyleForId(const Inspec RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(id, style, this); return inspectorStyle.release(); } - return it->value; + return it->second; } void InspectorStyleSheet::rememberInspectorStyle(RefPtr<InspectorStyle> inspectorStyle) diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/InspectorTimelineAgent.cpp index 1a2281529..a994cdd11 100644 --- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp +++ b/Source/WebCore/inspector/InspectorTimelineAgent.cpp @@ -234,6 +234,8 @@ void InspectorTimelineAgent::didDispatchEvent() void InspectorTimelineAgent::didInvalidateLayout(Frame* frame) { + if (frame->view()->layoutPending()) + return; appendRecord(InspectorObject::create(), TimelineRecordType::InvalidateLayout, true, frame); } diff --git a/Source/WebCore/inspector/InspectorValues.cpp b/Source/WebCore/inspector/InspectorValues.cpp index ada2617cc..e4ead17e5 100644 --- a/Source/WebCore/inspector/InspectorValues.cpp +++ b/Source/WebCore/inspector/InspectorValues.cpp @@ -717,7 +717,7 @@ PassRefPtr<InspectorValue> InspectorObjectBase::get(const String& name) const Dictionary::const_iterator it = m_data.find(name); if (it == m_data.end()) return 0; - return it->value; + return it->second; } void InspectorObjectBase::remove(const String& name) @@ -739,9 +739,9 @@ void InspectorObjectBase::writeJSON(StringBuilder* output) const ASSERT(it != m_data.end()); if (i) output->append(','); - doubleQuoteString(it->key, output); + doubleQuoteString(it->first, output); output->append(':'); - it->value->writeJSON(output); + it->second->writeJSON(output); } output->append('}'); } diff --git a/Source/WebCore/inspector/InspectorWorkerAgent.cpp b/Source/WebCore/inspector/InspectorWorkerAgent.cpp index e90f7cb4b..1b7cedbc3 100644 --- a/Source/WebCore/inspector/InspectorWorkerAgent.cpp +++ b/Source/WebCore/inspector/InspectorWorkerAgent.cpp @@ -205,9 +205,9 @@ void InspectorWorkerAgent::workerContextTerminated(WorkerContextProxy* proxy) { m_dedicatedWorkers.remove(proxy); for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChannel.end(); ++it) { - if (proxy == it->value->proxy()) { - m_inspectorFrontend->worker()->workerTerminated(it->key); - delete it->value; + if (proxy == it->second->proxy()) { + m_inspectorFrontend->worker()->workerTerminated(it->first); + delete it->second; m_idToChannel.remove(it); return; } @@ -217,14 +217,14 @@ void InspectorWorkerAgent::workerContextTerminated(WorkerContextProxy* proxy) void InspectorWorkerAgent::createWorkerFrontendChannelsForExistingWorkers() { for (DedicatedWorkers::iterator it = m_dedicatedWorkers.begin(); it != m_dedicatedWorkers.end(); ++it) - createWorkerFrontendChannel(it->key, it->value); + createWorkerFrontendChannel(it->first, it->second); } void InspectorWorkerAgent::destroyWorkerFrontendChannels() { for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChannel.end(); ++it) { - it->value->disconnectFromWorkerContext(); - delete it->value; + it->second->disconnectFromWorkerContext(); + delete it->second; } m_idToChannel.clear(); } diff --git a/Source/WebCore/inspector/JavaScriptCallFrame.idl b/Source/WebCore/inspector/JavaScriptCallFrame.idl index 17011e492..d373d5d82 100644 --- a/Source/WebCore/inspector/JavaScriptCallFrame.idl +++ b/Source/WebCore/inspector/JavaScriptCallFrame.idl @@ -23,30 +23,33 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=JAVASCRIPT_DEBUGGER, - OmitConstructor, - DoNotCheckConstants -] interface JavaScriptCallFrame { +module inspector { - // Scope type - const unsigned short GLOBAL_SCOPE = 0; - const unsigned short LOCAL_SCOPE = 1; - const unsigned short WITH_SCOPE = 2; - const unsigned short CLOSURE_SCOPE = 3; - const unsigned short CATCH_SCOPE = 4; + interface [ + Conditional=JAVASCRIPT_DEBUGGER, + OmitConstructor, + DoNotCheckConstants + ] JavaScriptCallFrame { - [Custom] void evaluate(in DOMString script); - [Custom] DOMObject restart(); + // Scope type + const unsigned short GLOBAL_SCOPE = 0; + const unsigned short LOCAL_SCOPE = 1; + const unsigned short WITH_SCOPE = 2; + const unsigned short CLOSURE_SCOPE = 3; + const unsigned short CATCH_SCOPE = 4; - readonly attribute JavaScriptCallFrame caller; - readonly attribute long sourceID; - readonly attribute long line; - readonly attribute long column; - [CustomGetter] readonly attribute Array scopeChain; - [Custom] unsigned short scopeType(in int scopeIndex); - [CustomGetter] readonly attribute Object thisObject; - readonly attribute DOMString functionName; - [CustomGetter] readonly attribute DOMString type; -}; + [Custom] void evaluate(in DOMString script); + [Custom] DOMObject restart(); + readonly attribute JavaScriptCallFrame caller; + readonly attribute long sourceID; + readonly attribute long line; + readonly attribute long column; + readonly attribute [CustomGetter] Array scopeChain; + [Custom] unsigned short scopeType(in int scopeIndex); + readonly attribute [CustomGetter] Object thisObject; + readonly attribute DOMString functionName; + readonly attribute [CustomGetter] DOMString type; + }; + +} diff --git a/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp b/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp index e93d66f4f..946888ce2 100644 --- a/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp +++ b/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp @@ -34,63 +34,11 @@ #include "MemoryInstrumentationImpl.h" -#include "WebCoreMemoryInstrumentation.h" -#include <wtf/Assertions.h> -#include <wtf/MemoryInstrumentationHashMap.h> -#include <wtf/MemoryInstrumentationHashSet.h> -#include <wtf/MemoryInstrumentationVector.h> -#include <wtf/text/StringHash.h> - namespace WebCore { -TypeNameToSizeMap MemoryInstrumentationClientImpl::sizesMap() const +MemoryInstrumentationImpl::MemoryInstrumentationImpl(VisitedObjects& visitedObjects) + : m_visitedObjects(visitedObjects) { - // TypeToSizeMap uses const char* as the key. - // Thus it could happen that we have two different keys with equal string. - TypeNameToSizeMap sizesMap; - for (TypeToSizeMap::const_iterator i = m_totalSizes.begin(); i != m_totalSizes.end(); ++i) { - String objectType(i->key); - TypeNameToSizeMap::AddResult result = sizesMap.add(objectType, i->value); - if (!result.isNewEntry) - result.iterator->value += i->value; - } - - return sizesMap; -} - -void MemoryInstrumentationClientImpl::countObjectSize(MemoryObjectType objectType, size_t size) -{ - ASSERT(objectType); - TypeToSizeMap::AddResult result = m_totalSizes.add(objectType, size); - if (!result.isNewEntry) - result.iterator->value += size; - ++m_totalCountedObjects; -} - -bool MemoryInstrumentationClientImpl::visited(const void* object) -{ - return !m_visitedObjects.add(object).isNewEntry; -} - -void MemoryInstrumentationClientImpl::checkCountedObject(const void* object) -{ - if (!checkInstrumentedObjects()) - return; - if (!m_allocatedObjects.contains(object)) { - ++m_totalObjectsNotInAllocatedSet; -#if 0 - printf("Found unknown object referenced by pointer: %p\n", object); - WTFReportBacktrace(); -#endif - } -} - -void MemoryInstrumentationClientImpl::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const -{ - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorMemoryAgent); - info.addMember(m_totalSizes); - info.addMember(m_visitedObjects); - info.addMember(m_allocatedObjects); } void MemoryInstrumentationImpl::processDeferredInstrumentedPointers() @@ -102,17 +50,28 @@ void MemoryInstrumentationImpl::processDeferredInstrumentedPointers() } } +void MemoryInstrumentationImpl::countObjectSize(MemoryObjectType objectType, size_t size) +{ + ASSERT(objectType); + TypeToSizeMap::AddResult result = m_totalSizes.add(objectType, size); + if (!result.isNewEntry) + result.iterator->second += size; +} + void MemoryInstrumentationImpl::deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase> pointer) { m_deferredInstrumentedPointers.append(pointer); } -void MemoryInstrumentationImpl::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +bool MemoryInstrumentationImpl::visited(const void* object) { - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorMemoryAgent); - info.addMember(m_deferredInstrumentedPointers); + return !m_visitedObjects.add(object).isNewEntry; } +size_t MemoryInstrumentationImpl::selfSize() const +{ + return calculateContainerSize(m_visitedObjects) + calculateContainerSize(m_deferredInstrumentedPointers); +} } // namespace WebCore diff --git a/Source/WebCore/inspector/MemoryInstrumentationImpl.h b/Source/WebCore/inspector/MemoryInstrumentationImpl.h index 8af8d60c5..8a2aee5e0 100644 --- a/Source/WebCore/inspector/MemoryInstrumentationImpl.h +++ b/Source/WebCore/inspector/MemoryInstrumentationImpl.h @@ -37,74 +37,41 @@ #include <wtf/HashSet.h> #include <wtf/MemoryInstrumentation.h> #include <wtf/Vector.h> -#include <wtf/text/StringHash.h> using WTF::MemoryObjectType; namespace WebCore { typedef HashSet<const void*> VisitedObjects; -typedef HashMap<String, size_t> TypeNameToSizeMap; -class MemoryInstrumentationClientImpl : public WTF::MemoryInstrumentationClient { +class MemoryInstrumentationImpl : public WTF::MemoryInstrumentation { public: - MemoryInstrumentationClientImpl() - : m_totalCountedObjects(0) - , m_totalObjectsNotInAllocatedSet(0) - { } + explicit MemoryInstrumentationImpl(VisitedObjects&); + size_t selfSize() const; size_t totalSize(MemoryObjectType objectType) const { TypeToSizeMap::const_iterator i = m_totalSizes.find(objectType); - return i == m_totalSizes.end() ? 0 : i->value; + return i == m_totalSizes.end() ? 0 : i->second; } size_t reportedSizeForAllTypes() const { size_t size = 0; for (TypeToSizeMap::const_iterator i = m_totalSizes.begin(); i != m_totalSizes.end(); ++i) - size += i->value; + size += i->second; return size; } - TypeNameToSizeMap sizesMap() const; - VisitedObjects& allocatedObjects() { return m_allocatedObjects; } - - bool checkInstrumentedObjects() const { return !m_allocatedObjects.isEmpty(); } - size_t visitedObjects() const { return m_visitedObjects.size(); } - size_t totalCountedObjects() const { return m_totalCountedObjects; } - size_t totalObjectsNotInAllocatedSet() const { return m_totalObjectsNotInAllocatedSet; } - +private: virtual void countObjectSize(MemoryObjectType, size_t) OVERRIDE; + virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) OVERRIDE; virtual bool visited(const void*) OVERRIDE; - virtual void checkCountedObject(const void*) OVERRIDE; - - void reportMemoryUsage(MemoryObjectInfo*) const; + virtual void processDeferredInstrumentedPointers() OVERRIDE; -private: typedef HashMap<MemoryObjectType, size_t> TypeToSizeMap; TypeToSizeMap m_totalSizes; - VisitedObjects m_visitedObjects; - VisitedObjects m_allocatedObjects; - size_t m_totalCountedObjects; - size_t m_totalObjectsNotInAllocatedSet; -}; - -class MemoryInstrumentationImpl : public WTF::MemoryInstrumentation { -public: - explicit MemoryInstrumentationImpl(WTF::MemoryInstrumentationClient* client) - : MemoryInstrumentation(client) - { - } - - size_t selfSize() const; - - void reportMemoryUsage(MemoryObjectInfo*) const; - -private: - virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) OVERRIDE; - virtual void processDeferredInstrumentedPointers() OVERRIDE; - + VisitedObjects& m_visitedObjects; Vector<OwnPtr<InstrumentedPointerBase> > m_deferredInstrumentedPointers; }; diff --git a/Source/WebCore/inspector/NetworkResourcesData.cpp b/Source/WebCore/inspector/NetworkResourcesData.cpp index 788ebea55..4198fb51d 100644 --- a/Source/WebCore/inspector/NetworkResourcesData.cpp +++ b/Source/WebCore/inspector/NetworkResourcesData.cpp @@ -291,8 +291,8 @@ void NetworkResourcesData::setXHRReplayData(const String& requestId, XHRReplayDa ReusedRequestIds::iterator it; ReusedRequestIds::iterator end = m_reusedXHRReplayDataRequestIds.end(); for (it = m_reusedXHRReplayDataRequestIds.begin(); it != end; ++it) { - if (it->value == requestId) - setXHRReplayData(it->key, xhrReplayData); + if (it->second == requestId) + setXHRReplayData(it->first, xhrReplayData); } return; } @@ -318,10 +318,10 @@ Vector<String> NetworkResourcesData::removeCachedResource(CachedResource* cached ResourceDataMap::iterator it; ResourceDataMap::iterator end = m_requestIdToResourceDataMap.end(); for (it = m_requestIdToResourceDataMap.begin(); it != end; ++it) { - ResourceData* resourceData = it->value; + ResourceData* resourceData = it->second; if (resourceData->cachedResource() == cachedResource) { resourceData->setCachedResource(0); - result.append(it->key); + result.append(it->first); } } @@ -338,9 +338,9 @@ void NetworkResourcesData::clear(const String& preservedLoaderId) ResourceDataMap::iterator it; ResourceDataMap::iterator end = m_requestIdToResourceDataMap.end(); for (it = m_requestIdToResourceDataMap.begin(); it != end; ++it) { - ResourceData* resourceData = it->value; + ResourceData* resourceData = it->second; if (!preservedLoaderId.isNull() && resourceData->loaderId() == preservedLoaderId) - preservedMap.set(it->key, it->value); + preservedMap.set(it->first, it->second); else delete resourceData; } diff --git a/Source/WebCore/inspector/PageRuntimeAgent.cpp b/Source/WebCore/inspector/PageRuntimeAgent.cpp index 74c3b7ff9..254957a7f 100644 --- a/Source/WebCore/inspector/PageRuntimeAgent.cpp +++ b/Source/WebCore/inspector/PageRuntimeAgent.cpp @@ -50,7 +50,7 @@ using WebCore::TypeBuilder::Runtime::ExecutionContextDescription; namespace WebCore { namespace PageRuntimeAgentState { -static const char runtimeEnabled[] = "runtimeEnabled"; +static const char reportExecutionContextCreation[] = "reportExecutionContextCreation"; }; PageRuntimeAgent::PageRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent, InspectorAgent* inspectorAgent) @@ -76,44 +76,47 @@ void PageRuntimeAgent::clearFrontend() { m_instrumentingAgents->setPageRuntimeAgent(0); m_frontend = 0; - String errorString; - disable(&errorString); + m_state->setBoolean(PageRuntimeAgentState::reportExecutionContextCreation, false); } void PageRuntimeAgent::restore() { - if (m_state->getBoolean(PageRuntimeAgentState::runtimeEnabled)) { - String error; - enable(&error); - } -} - -void PageRuntimeAgent::enable(ErrorString* errorString) -{ - if (m_enabled) + if (!m_state->getBoolean(PageRuntimeAgentState::reportExecutionContextCreation)) return; - - InspectorRuntimeAgent::enable(errorString); - m_state->setBoolean(PageRuntimeAgentState::runtimeEnabled, true); // Only report existing contexts if the page did commit load, otherwise we may // unintentionally initialize contexts in the frames which may trigger some listeners // that are expected to be triggered only after the load is committed, see http://crbug.com/131623 - if (m_inspectorAgent->didCommitLoadFired()) - reportExecutionContextCreation(); + if (m_inspectorAgent->didCommitLoadFired()) { + String error; + setReportExecutionContextCreation(&error, true); + } } -void PageRuntimeAgent::disable(ErrorString* errorString) +void PageRuntimeAgent::setReportExecutionContextCreation(ErrorString*, bool enable) { - if (!m_enabled) + m_state->setBoolean(PageRuntimeAgentState::reportExecutionContextCreation, enable); + if (!enable) return; + Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts; + for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) + continue; + String frameId = m_pageAgent->frameId(frame); - InspectorRuntimeAgent::disable(errorString); - m_state->setBoolean(PageRuntimeAgentState::runtimeEnabled, false); + ScriptState* scriptState = mainWorldScriptState(frame); + notifyContextCreated(frameId, scriptState, 0, true); + frame->script()->collectIsolatedContexts(isolatedContexts); + if (isolatedContexts.isEmpty()) + continue; + for (size_t i = 0; i< isolatedContexts.size(); i++) + notifyContextCreated(frameId, isolatedContexts[i].first, isolatedContexts[i].second, false); + isolatedContexts.clear(); + } } void PageRuntimeAgent::didClearWindowObject(Frame* frame) { - if (!m_enabled) + if (!m_state->getBoolean(PageRuntimeAgentState::reportExecutionContextCreation)) return; ASSERT(m_frontend); String frameId = m_pageAgent->frameId(frame); @@ -123,7 +126,7 @@ void PageRuntimeAgent::didClearWindowObject(Frame* frame) void PageRuntimeAgent::didCreateIsolatedContext(Frame* frame, ScriptState* scriptState, SecurityOrigin* origin) { - if (!m_enabled) + if (!m_state->getBoolean(PageRuntimeAgentState::reportExecutionContextCreation)) return; ASSERT(m_frontend); String frameId = m_pageAgent->frameId(frame); @@ -152,25 +155,6 @@ void PageRuntimeAgent::unmuteConsole() Console::unmute(); } -void PageRuntimeAgent::reportExecutionContextCreation() -{ - Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts; - for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) - continue; - String frameId = m_pageAgent->frameId(frame); - - ScriptState* scriptState = mainWorldScriptState(frame); - notifyContextCreated(frameId, scriptState, 0, true); - frame->script()->collectIsolatedContexts(isolatedContexts); - if (isolatedContexts.isEmpty()) - continue; - for (size_t i = 0; i< isolatedContexts.size(); i++) - notifyContextCreated(frameId, isolatedContexts[i].first, isolatedContexts[i].second, false); - isolatedContexts.clear(); - } -} - void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext) { ASSERT(securityOrigin || isPageContext); diff --git a/Source/WebCore/inspector/PageRuntimeAgent.h b/Source/WebCore/inspector/PageRuntimeAgent.h index 5278aa737..9c92d807a 100644 --- a/Source/WebCore/inspector/PageRuntimeAgent.h +++ b/Source/WebCore/inspector/PageRuntimeAgent.h @@ -55,8 +55,7 @@ public: virtual void setFrontend(InspectorFrontend*); virtual void clearFrontend(); virtual void restore(); - virtual void enable(ErrorString*); - virtual void disable(ErrorString*); + virtual void setReportExecutionContextCreation(ErrorString*, bool); void didClearWindowObject(Frame*); void didCreateIsolatedContext(Frame*, ScriptState*, SecurityOrigin*); @@ -67,7 +66,6 @@ private: virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId); virtual void muteConsole(); virtual void unmuteConsole(); - void reportExecutionContextCreation(); void notifyContextCreated(const String& frameId, ScriptState*, SecurityOrigin*, bool isPageContext); Page* m_inspectedPage; diff --git a/Source/WebCore/inspector/ScriptProfile.idl b/Source/WebCore/inspector/ScriptProfile.idl index 46c0e99c3..ebbee2e8e 100644 --- a/Source/WebCore/inspector/ScriptProfile.idl +++ b/Source/WebCore/inspector/ScriptProfile.idl @@ -24,13 +24,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=JAVASCRIPT_DEBUGGER, - OmitConstructor, - V8CustomToJSObject -] interface ScriptProfile { - readonly attribute DOMString title; - readonly attribute unsigned long uid; - readonly attribute ScriptProfileNode head; -}; +module core { + interface [ + Conditional=JAVASCRIPT_DEBUGGER, + OmitConstructor, + V8CustomToJSObject + ] ScriptProfile { + readonly attribute DOMString title; + readonly attribute unsigned long uid; + readonly attribute ScriptProfileNode head; + }; + +} diff --git a/Source/WebCore/inspector/ScriptProfileNode.idl b/Source/WebCore/inspector/ScriptProfileNode.idl index 3b28b8867..a14798c05 100644 --- a/Source/WebCore/inspector/ScriptProfileNode.idl +++ b/Source/WebCore/inspector/ScriptProfileNode.idl @@ -24,19 +24,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=JAVASCRIPT_DEBUGGER, - OmitConstructor, - V8CustomToJSObject -] interface ScriptProfileNode { - readonly attribute DOMString functionName; - readonly attribute DOMString url; - readonly attribute unsigned long lineNumber; - readonly attribute double totalTime; - readonly attribute double selfTime; - readonly attribute unsigned long numberOfCalls; - sequence<ScriptProfileNode> children(); - readonly attribute boolean visible; - [CustomGetter] readonly attribute unsigned long callUID; -}; +module core { + interface [ + Conditional=JAVASCRIPT_DEBUGGER, + OmitConstructor, + V8CustomToJSObject + ] ScriptProfileNode { + readonly attribute DOMString functionName; + readonly attribute DOMString url; + readonly attribute unsigned long lineNumber; + readonly attribute double totalTime; + readonly attribute double selfTime; + readonly attribute unsigned long numberOfCalls; + sequence<ScriptProfileNode> children(); + readonly attribute boolean visible; + readonly attribute [CustomGetter] unsigned long callUID; + }; + +} diff --git a/Source/WebCore/inspector/WorkerRuntimeAgent.cpp b/Source/WebCore/inspector/WorkerRuntimeAgent.cpp index d74e2acfb..30c077001 100644 --- a/Source/WebCore/inspector/WorkerRuntimeAgent.cpp +++ b/Source/WebCore/inspector/WorkerRuntimeAgent.cpp @@ -49,6 +49,11 @@ WorkerRuntimeAgent::~WorkerRuntimeAgent() { } +void WorkerRuntimeAgent::setReportExecutionContextCreation(ErrorString* error, bool) +{ + *error = "Isolated contexts are not supported for workers."; +} + InjectedScript WorkerRuntimeAgent::injectedScriptForEval(ErrorString* error, const int* executionContextId) { if (executionContextId) { diff --git a/Source/WebCore/inspector/WorkerRuntimeAgent.h b/Source/WebCore/inspector/WorkerRuntimeAgent.h index 9f1997b74..6311093bf 100644 --- a/Source/WebCore/inspector/WorkerRuntimeAgent.h +++ b/Source/WebCore/inspector/WorkerRuntimeAgent.h @@ -47,6 +47,7 @@ public: return adoptPtr(new WorkerRuntimeAgent(instrumentingAgents, state, injectedScriptManager, context)); } virtual ~WorkerRuntimeAgent(); + virtual void setReportExecutionContextCreation(ErrorString*, bool); private: WorkerRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, WorkerContext*); diff --git a/Source/WebCore/inspector/compile-front-end.py b/Source/WebCore/inspector/compile-front-end.py index a7b42f12e..76dcaef34 100755 --- a/Source/WebCore/inspector/compile-front-end.py +++ b/Source/WebCore/inspector/compile-front-end.py @@ -46,10 +46,8 @@ modules = [ "dependencies": [], "sources": [ "Color.js", - "DOMExtension.js", "Object.js", "ParsedURL.js", - "Progress.js", "Settings.js", "UIString.js", "UserMetrics.js", @@ -86,7 +84,6 @@ modules = [ "NetworkLog.js", "NetworkUISourceCodeProvider.js", "PresentationConsoleMessageHelper.js", - "RuntimeModel.js", "SASSSourceMapping.js", "Script.js", "ScriptFormatter.js", @@ -116,6 +113,7 @@ modules = [ "sources": [ "Checkbox.js", "ContextMenu.js", + "DOMExtension.js", "DOMSyntaxHighlighter.js", "DataGrid.js", "DefaultTextEditor.js", @@ -130,7 +128,7 @@ modules = [ "PanelEnablerView.js", "Placard.js", "Popover.js", - "ProgressIndicator.js", + "ProgressBar.js", "PropertiesSection.js", "SearchController.js", "Section.js", @@ -172,6 +170,7 @@ modules = [ "NativeBreakpointsSidebarPane.js", "ObjectPopoverHelper.js", "ObjectPropertiesSection.js", + "RuntimeModel.js", "SourceFrame.js", "ResourceView.js", ] @@ -225,15 +224,8 @@ modules = [ ] }, { - "name": "workers", - "dependencies": ["components"], - "sources": [ - "WorkerManager.js", - ] - }, - { "name": "scripts", - "dependencies": ["components", "workers"], + "dependencies": ["components"], "sources": [ "BreakpointsSidebarPane.js", "CallStackSidebarPane.js", @@ -307,6 +299,13 @@ modules = [ ] }, { + "name": "workers", + "dependencies": ["components"], + "sources": [ + "WorkerManager.js", + ] + }, + { "name": "tests", "dependencies": ["components"], "sources": [ @@ -340,17 +339,9 @@ modules = [ "name": "host_stub", "dependencies": ["ui"], "sources": [ - "InspectorFrontendAPI.js", "InspectorFrontendHostStub.js", ] }, - { - "name": "inspector", - "dependencies": ["components"], - "sources": [ - "DockController.js", - ] - }, ] modules_by_name = {} diff --git a/Source/WebCore/inspector/front-end/AdvancedSearchController.js b/Source/WebCore/inspector/front-end/AdvancedSearchController.js index 9dfa78cd5..b500a663b 100644 --- a/Source/WebCore/inspector/front-end/AdvancedSearchController.js +++ b/Source/WebCore/inspector/front-end/AdvancedSearchController.js @@ -222,6 +222,8 @@ WebInspector.SearchView = function(controller) WebInspector.SearchView.maxQueriesCount = 20; WebInspector.SearchView.prototype = { + __proto__: WebInspector.View.prototype, + /** * @return {Array.<Element>} */ @@ -385,11 +387,10 @@ WebInspector.SearchView.prototype = { this._save(); this._controller.startSearch(this.searchConfig); - }, - - __proto__: WebInspector.View.prototype + } } +//WebInspector.SearchView.prototype.__proto__ = WebInspector.View.prototype; /** * @constructor @@ -666,11 +667,11 @@ WebInspector.FileBasedSearchResultsPane.prototype = { contentSpan.textContent = lineContent; WebInspector.highlightRangesWithStyleClass(contentSpan, matchRanges, "highlighted-match"); return contentSpan; - }, - - __proto__: WebInspector.SearchResultsPane.prototype + } } +WebInspector.FileBasedSearchResultsPane.prototype.__proto__ = WebInspector.SearchResultsPane.prototype; + /** * @constructor * @param {WebInspector.UISourceCode} uiSourceCode diff --git a/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js b/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js index d59447070..f46928db7 100644 --- a/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js +++ b/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js @@ -271,7 +271,6 @@ WebInspector.ApplicationCacheItemsView.prototype = { // InspectorBackend.deleteCachedResource(...) // this._update(); }, - - __proto__: WebInspector.View.prototype } +WebInspector.ApplicationCacheItemsView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/ApplicationCacheModel.js b/Source/WebCore/inspector/front-end/ApplicationCacheModel.js index b5529a666..9b8f2b00b 100644 --- a/Source/WebCore/inspector/front-end/ApplicationCacheModel.js +++ b/Source/WebCore/inspector/front-end/ApplicationCacheModel.js @@ -218,11 +218,11 @@ WebInspector.ApplicationCacheModel.prototype = { { this._onLine = isNowOnline; this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged, isNowOnline); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.ApplicationCacheModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {ApplicationCacheAgent.Dispatcher} diff --git a/Source/WebCore/inspector/front-end/AuditCategories.js b/Source/WebCore/inspector/front-end/AuditCategories.js index ffd3f6342..b32b418d0 100644 --- a/Source/WebCore/inspector/front-end/AuditCategories.js +++ b/Source/WebCore/inspector/front-end/AuditCategories.js @@ -45,11 +45,11 @@ WebInspector.AuditCategories.PagePerformance.prototype = { this.addRule(new WebInspector.AuditRules.CssInHeadRule(), WebInspector.AuditRule.Severity.Severe); this.addRule(new WebInspector.AuditRules.StylesScriptsOrderRule(), WebInspector.AuditRule.Severity.Severe); this.addRule(new WebInspector.AuditRules.VendorPrefixedCSSProperties(), WebInspector.AuditRule.Severity.Warning); - }, - - __proto__: WebInspector.AuditCategory.prototype + } } +WebInspector.AuditCategories.PagePerformance.prototype.__proto__ = WebInspector.AuditCategory.prototype; + /** * @constructor * @extends {WebInspector.AuditCategory} @@ -73,7 +73,7 @@ WebInspector.AuditCategories.NetworkUtilization.prototype = { this.addRule(new WebInspector.AuditRules.ParallelizeDownloadRule(4, 10, 0.5), WebInspector.AuditRule.Severity.Warning); this.addRule(new WebInspector.AuditRules.BrowserCacheControlRule(), WebInspector.AuditRule.Severity.Severe); this.addRule(new WebInspector.AuditRules.ProxyCacheControlRule(), WebInspector.AuditRule.Severity.Warning); - }, - - __proto__: WebInspector.AuditCategory.prototype + } } + +WebInspector.AuditCategories.NetworkUtilization.prototype.__proto__ = WebInspector.AuditCategory.prototype; diff --git a/Source/WebCore/inspector/front-end/AuditLauncherView.js b/Source/WebCore/inspector/front-end/AuditLauncherView.js index 2939f1b21..97d088653 100644 --- a/Source/WebCore/inspector/front-end/AuditLauncherView.js +++ b/Source/WebCore/inspector/front-end/AuditLauncherView.js @@ -249,7 +249,7 @@ WebInspector.AuditLauncherView.prototype = { { this._launchButton.textContent = this._auditRunning ? WebInspector.UIString("Stop") : WebInspector.UIString("Run"); this._launchButton.disabled = !this._currentCategoriesCount; - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.AuditLauncherView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/AuditResultView.js b/Source/WebCore/inspector/front-end/AuditResultView.js index dbd7a89c7..4cfc43168 100644 --- a/Source/WebCore/inspector/front-end/AuditResultView.js +++ b/Source/WebCore/inspector/front-end/AuditResultView.js @@ -46,9 +46,10 @@ WebInspector.AuditResultView = function(categoryResults) } WebInspector.AuditResultView.prototype = { - __proto__: WebInspector.View.prototype } +WebInspector.AuditResultView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.SidebarPane} @@ -117,7 +118,7 @@ WebInspector.AuditCategoryResultPane.prototype = { treeElement.expand(); } return treeElement; - }, - - __proto__: WebInspector.SidebarPane.prototype + } } + +WebInspector.AuditCategoryResultPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/AuditRules.js b/Source/WebCore/inspector/front-end/AuditRules.js index 383482f5b..14b59ac47 100644 --- a/Source/WebCore/inspector/front-end/AuditRules.js +++ b/Source/WebCore/inspector/front-end/AuditRules.js @@ -120,11 +120,11 @@ WebInspector.AuditRules.GzipRule.prototype = { _shouldCompress: function(request) { return request.type.isTextType() && request.parsedURL.host && request.resourceSize !== undefined && request.resourceSize > 150; - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.GzipRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRule} @@ -164,11 +164,11 @@ WebInspector.AuditRules.CombineExternalResourcesRule.prototype = { summary.value = "There are multiple resources served from same domain. Consider combining them into as few files as possible."; callback(result); - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.CombineExternalResourcesRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRules.CombineExternalResourcesRule} @@ -177,9 +177,7 @@ WebInspector.AuditRules.CombineJsResourcesRule = function(allowedPerDomain) { WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externaljs", "Combine external JavaScript", WebInspector.resourceTypes.Script, "JavaScript", allowedPerDomain); } -WebInspector.AuditRules.CombineJsResourcesRule.prototype = { - __proto__: WebInspector.AuditRules.CombineExternalResourcesRule.prototype -} +WebInspector.AuditRules.CombineJsResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype; /** * @constructor @@ -189,9 +187,7 @@ WebInspector.AuditRules.CombineCssResourcesRule = function(allowedPerDomain) { WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externalcss", "Combine external CSS", WebInspector.resourceTypes.Stylesheet, "CSS", allowedPerDomain); } -WebInspector.AuditRules.CombineCssResourcesRule.prototype = { - __proto__: WebInspector.AuditRules.CombineExternalResourcesRule.prototype -} +WebInspector.AuditRules.CombineCssResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype; /** * @constructor @@ -229,11 +225,11 @@ WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype = { summary.value = "The following domains only serve one resource each. If possible, avoid the extra DNS lookups by serving these resources from existing domains."; callback(result); - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRule} @@ -305,11 +301,11 @@ WebInspector.AuditRules.ParallelizeDownloadRule.prototype = { result.violationCount = requestsOnBusiestHost.length; callback(result); - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.ParallelizeDownloadRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * The reported CSS rule size is incorrect (parsed != original in WebKit), * so use percentages instead, which gives a better approximation. @@ -457,11 +453,11 @@ WebInspector.AuditRules.UnusedCssRule.prototype = { } CSSAgent.getAllStyleSheets(allStylesCallback); - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.UnusedCssRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRule} @@ -603,11 +599,11 @@ WebInspector.AuditRules.CacheControlRule.prototype = { isCacheableResource: function(request) { return request.statusCode !== undefined && WebInspector.AuditRules.CacheableResponseCodes[request.statusCode]; - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.CacheControlRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRules.CacheControlRule} @@ -672,11 +668,11 @@ WebInspector.AuditRules.BrowserCacheControlRule.prototype = { !this.hasResponseHeader(request, "Set-Cookie") && !this.freshnessLifetimeGreaterThan(request, 11 * WebInspector.AuditRules.CacheControlRule.MillisPerMonth) && this.freshnessLifetimeGreaterThan(request, WebInspector.AuditRules.CacheControlRule.MillisPerMonth); - }, - - __proto__: WebInspector.AuditRules.CacheControlRule.prototype + } } +WebInspector.AuditRules.BrowserCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRules.CacheControlRule} @@ -712,11 +708,11 @@ WebInspector.AuditRules.ProxyCacheControlRule.prototype = { _setCookieCacheableCheck: function(request) { return this.hasResponseHeader(request, "Set-Cookie") && this.isPubliclyCacheable(request); - }, - - __proto__: WebInspector.AuditRules.CacheControlRule.prototype + } } +WebInspector.AuditRules.ProxyCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRule} @@ -844,11 +840,11 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = { if (progress.isCanceled()) return; WebInspector.domAgent.requestDocument(onDocumentAvailable); - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.ImageDimensionsRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRule} @@ -934,11 +930,11 @@ WebInspector.AuditRules.CssInHeadRule.prototype = { } WebInspector.domAgent.requestDocument(onDocumentAvailable); - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.CssInHeadRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRule} @@ -1022,11 +1018,11 @@ WebInspector.AuditRules.StylesScriptsOrderRule.prototype = { } WebInspector.domAgent.requestDocument(onDocumentAvailable); - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.StylesScriptsOrderRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRule} @@ -1126,11 +1122,11 @@ WebInspector.AuditRules.CSSRuleBase.prototype = { visitProperty: function(styleSheet, property, result) { // Subclasses can implement. - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.CSSRuleBase.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRules.CSSRuleBase} @@ -1189,11 +1185,11 @@ WebInspector.AuditRules.VendorPrefixedCSSProperties.prototype = { ++result.violationCount; this._ruleResult.addSnippet(String.sprintf("\"" + this._webkitPrefix + "%s\" is used, but \"%s\" is supported.", normalPropertyName, normalPropertyName)); } - }, - - __proto__: WebInspector.AuditRules.CSSRuleBase.prototype + } } +WebInspector.AuditRules.VendorPrefixedCSSProperties.prototype.__proto__ = WebInspector.AuditRules.CSSRuleBase.prototype; + /** * @constructor * @extends {WebInspector.AuditRule} @@ -1242,11 +1238,11 @@ WebInspector.AuditRules.CookieRuleBase.prototype = { if (WebInspector.Cookies.cookieMatchesResourceURL(cookie, requests[i].url)) callback(requests[i], cookie); } - }, - - __proto__: WebInspector.AuditRule.prototype + } } +WebInspector.AuditRules.CookieRuleBase.prototype.__proto__ = WebInspector.AuditRule.prototype; + /** * @constructor * @extends {WebInspector.AuditRules.CookieRuleBase} @@ -1351,11 +1347,11 @@ WebInspector.AuditRules.CookieSizeRule.prototype = { entry.addURLs(bigAvgCookieDomains); result.violationCount += bigAvgCookieDomains.length; } - }, - - __proto__: WebInspector.AuditRules.CookieRuleBase.prototype + } } +WebInspector.AuditRules.CookieSizeRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype; + /** * @constructor * @extends {WebInspector.AuditRules.CookieRuleBase} @@ -1398,7 +1394,7 @@ WebInspector.AuditRules.StaticCookielessRule.prototype = { _collectorCallback: function(matchingResourceData, request, cookie) { matchingResourceData[request.url] = (matchingResourceData[request.url] || 0) + cookie.size; - }, - - __proto__: WebInspector.AuditRules.CookieRuleBase.prototype + } } + +WebInspector.AuditRules.StaticCookielessRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype; diff --git a/Source/WebCore/inspector/front-end/AuditsPanel.js b/Source/WebCore/inspector/front-end/AuditsPanel.js index 5d005a487..e48dbc046 100644 --- a/Source/WebCore/inspector/front-end/AuditsPanel.js +++ b/Source/WebCore/inspector/front-end/AuditsPanel.js @@ -239,11 +239,11 @@ WebInspector.AuditsPanel.prototype = { { this.auditsItemTreeElement.revealAndSelect(); this.auditResultsTreeElement.removeChildren(); - }, - - __proto__: WebInspector.Panel.prototype + } } +WebInspector.AuditsPanel.prototype.__proto__ = WebInspector.Panel.prototype; + /** * @constructor */ @@ -497,11 +497,11 @@ WebInspector.AuditsSidebarTreeElement.prototype = { refresh: function() { this.refreshTitles(); - }, - - __proto__: WebInspector.SidebarTreeElement.prototype + } } +WebInspector.AuditsSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + /** * @constructor * @extends {WebInspector.SidebarTreeElement} @@ -524,11 +524,11 @@ WebInspector.AuditResultSidebarTreeElement.prototype = { get selectable() { return true; - }, - - __proto__: WebInspector.SidebarTreeElement.prototype + } } +WebInspector.AuditResultSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + // Contributed audit rules should go into this namespace. WebInspector.AuditRules = {}; diff --git a/Source/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js b/Source/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js index 55d81fec0..f5982ad85 100644 --- a/Source/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js +++ b/Source/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js @@ -143,11 +143,11 @@ WebInspector.BottomUpProfileDataGridNode.prototype = { // In bottom up mode, our parents are our children since we display an inverted tree. // However, we don't want to show the very top parent since it is redundant. return !!(profileNode.parent && profileNode.parent.parent); - }, - - __proto__: WebInspector.ProfileDataGridNode.prototype + } } +WebInspector.BottomUpProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype; + /** * @constructor * @extends {WebInspector.ProfileDataGridTree} @@ -266,7 +266,8 @@ WebInspector.BottomUpProfileDataGridTree.prototype = { this.sort(this.lastComparator, true); }, - _sharedPopulate: WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate, - - __proto__: WebInspector.ProfileDataGridTree.prototype + _sharedPopulate: WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate } + +WebInspector.BottomUpProfileDataGridTree.prototype.__proto__ = WebInspector.ProfileDataGridTree.prototype; + diff --git a/Source/WebCore/inspector/front-end/BreakpointManager.js b/Source/WebCore/inspector/front-end/BreakpointManager.js index 16f34e914..8e9d4b655 100644 --- a/Source/WebCore/inspector/front-end/BreakpointManager.js +++ b/Source/WebCore/inspector/front-end/BreakpointManager.js @@ -49,8 +49,6 @@ WebInspector.BreakpointManager = function(breakpointStorage, debuggerModel, work this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this); this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._workspaceReset, this); this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this); - this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeAdded, this._uiSourceCodeAdded, this); - this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeRemoved, this._uiSourceCodeRemoved, this); } WebInspector.BreakpointManager.Events = { @@ -58,18 +56,13 @@ WebInspector.BreakpointManager.Events = { BreakpointRemoved: "breakpoint-removed" } -WebInspector.BreakpointManager.breakpointStorageId = function(uiSourceCode) -{ - return uiSourceCode.formatted() ? "deobfuscated:" + uiSourceCode.url : uiSourceCode.url; -} - WebInspector.BreakpointManager.prototype = { /** * @param {WebInspector.UISourceCode} uiSourceCode */ restoreBreakpoints: function(uiSourceCode) { - var sourceFileId = WebInspector.BreakpointManager.breakpointStorageId(uiSourceCode); + var sourceFileId = uiSourceCode.breakpointStorageId(); if (!sourceFileId || this._sourceFilesWithRestoredBreakpoints[sourceFileId]) return; this._sourceFilesWithRestoredBreakpoints[sourceFileId] = true; @@ -81,7 +74,6 @@ WebInspector.BreakpointManager.prototype = { continue; this._debuggerModel.removeBreakpoint(debuggerId); delete this._breakpointForDebuggerId[debuggerId]; - delete breakpoint._debuggerId; } this._storage._restoreBreakpoints(uiSourceCode); }, @@ -97,40 +89,6 @@ WebInspector.BreakpointManager.prototype = { }, /** - * @param {WebInspector.Event} event - */ - _uiSourceCodeRemoved: function(event) - { - var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; - if (!(uiSourceCode instanceof WebInspector.JavaScriptSource)) - return; - if (uiSourceCode.divergedVersion) - return; - - var sourceFileId = WebInspector.BreakpointManager.breakpointStorageId(uiSourceCode); - if (!sourceFileId) - return; - - var breakpoints = this._breakpoints.slice(); - for (var i = 0; i < breakpoints.length; ++i) { - var breakpoint = breakpoints[i]; - for (var stringifiedLocation in breakpoint._uiLocations) { - var uiLocation = breakpoint._uiLocations[stringifiedLocation]; - if (uiLocation.uiSourceCode === uiSourceCode) - breakpoint.remove(true); - } - } - - delete this._sourceFilesWithRestoredBreakpoints[sourceFileId]; - - var uiSourceCodes = this._workspace.uiSourceCodes(); - for (var i = 0; i < uiSourceCodes.length; ++i) { - if (WebInspector.BreakpointManager.breakpointStorageId(uiSourceCodes[i]) === sourceFileId) - this.restoreBreakpoints(uiSourceCodes[i]); - } - }, - - /** * @param {WebInspector.UISourceCode} uiSourceCode * @param {number} lineNumber * @param {string} condition @@ -175,17 +133,17 @@ WebInspector.BreakpointManager.prototype = { }, /** - * @param {function(WebInspector.BreakpointManager.Breakpoint, WebInspector.UILocation)} filter - * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, uiLocation: WebInspector.UILocation}>} + * @param {WebInspector.UISourceCode} uiSourceCode + * @return {Array.<Object>} */ - _filteredBreakpointLocations: function(filter) + breakpointLocationsForUISourceCode: function(uiSourceCode) { var result = []; for (var i = 0; i < this._breakpoints.length; ++i) { var breakpoint = this._breakpoints[i]; for (var stringifiedLocation in breakpoint._uiLocations) { var uiLocation = breakpoint._uiLocations[stringifiedLocation]; - if (filter(breakpoint, uiLocation)) + if (uiLocation.uiSourceCode === uiSourceCode) result.push({breakpoint: breakpoint, uiLocation: uiLocation}); } } @@ -193,28 +151,6 @@ WebInspector.BreakpointManager.prototype = { }, /** - * @param {WebInspector.UISourceCode} uiSourceCode - * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, uiLocation: WebInspector.UILocation}>} - */ - breakpointLocationsForUISourceCode: function(uiSourceCode) - { - function filter(breakpoint, uiLocation) - { - return uiLocation.uiSourceCode === uiSourceCode; - } - - return this._filteredBreakpointLocations(filter); - }, - - /** - * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, uiLocation: WebInspector.UILocation}>} - */ - allBreakpointLocations: function() - { - return this._filteredBreakpointLocations(function(breakpoint, uiLocation) { return true; }); - }, - - /** * @param {boolean} toggleState */ toggleAllBreakpoints: function(toggleState) @@ -321,11 +257,11 @@ WebInspector.BreakpointManager.prototype = { if (!lineBreakpoints.length) delete breakpoints[uiLocation.lineNumber]; this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.BreakpointRemoved, {breakpoint: breakpoint, uiLocation: uiLocation}); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.BreakpointManager.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {WebInspector.BreakpointManager} breakpointManager @@ -338,7 +274,7 @@ WebInspector.BreakpointManager.Breakpoint = function(breakpointManager, uiSource { this._breakpointManager = breakpointManager; this._primaryUILocation = new WebInspector.UILocation(uiSourceCode, lineNumber, 0); - this._sourceCodeStorageId = WebInspector.BreakpointManager.breakpointStorageId(uiSourceCode); + this._sourceCodeStorageId = uiSourceCode.breakpointStorageId(); /** @type {Array.<WebInspector.Script.Location>} */ this._liveLocations = []; /** @type {Object.<string, WebInspector.UILocation>} */ @@ -433,8 +369,7 @@ WebInspector.BreakpointManager.Breakpoint.prototype = { this._condition = condition; this._breakpointManager._storage._updateBreakpoint(this); - var scriptFile = this._primaryUILocation.uiSourceCode.scriptFile(); - if (this._enabled && !(scriptFile && scriptFile.hasDivergedFromVM())) { + if (this._enabled && !this._primaryUILocation.uiSourceCode.isDivergedFromVM()) { this._setInDebugger(); return; } @@ -442,15 +377,11 @@ WebInspector.BreakpointManager.Breakpoint.prototype = { this._fakeBreakpointAtPrimaryLocation(); }, - /** - * @param {boolean=} keepInStorage - */ - remove: function(keepInStorage) + remove: function() { - var removeFromStorage = !keepInStorage; this._resetLocations(); this._removeFromDebugger(); - this._breakpointManager._removeBreakpoint(this, removeFromStorage); + this._breakpointManager._removeBreakpoint(this, true); }, _setInDebugger: function() @@ -525,7 +456,7 @@ WebInspector.BreakpointManager.Breakpoint.prototype = { */ _breakpointStorageId: function() { - return WebInspector.BreakpointManager.breakpointStorageId(this._primaryUILocation.uiSourceCode) + ":" + this._primaryUILocation.lineNumber; + return this._primaryUILocation.uiSourceCode.breakpointStorageId() + ":" + this._primaryUILocation.lineNumber; }, _fakeBreakpointAtPrimaryLocation: function() @@ -561,7 +492,7 @@ WebInspector.BreakpointManager.Storage.prototype = { _restoreBreakpoints: function(uiSourceCode) { this._muted = true; - var breakpointStorageId = WebInspector.BreakpointManager.breakpointStorageId(uiSourceCode); + var breakpointStorageId = uiSourceCode.breakpointStorageId(); for (var id in this._breakpoints) { var breakpoint = this._breakpoints[id]; if (breakpoint.sourceFileId === breakpointStorageId) @@ -608,7 +539,7 @@ WebInspector.BreakpointManager.Storage.prototype = { WebInspector.BreakpointManager.Storage.Item = function(breakpoint) { var primaryUILocation = breakpoint.primaryUILocation(); - this.sourceFileId = WebInspector.BreakpointManager.breakpointStorageId(primaryUILocation.uiSourceCode); + this.sourceFileId = primaryUILocation.uiSourceCode.breakpointStorageId(); this.lineNumber = primaryUILocation.lineNumber; this.condition = breakpoint.condition(); this.enabled = breakpoint.enabled(); diff --git a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js index bc4bb6b02..4bdd4af7b 100644 --- a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js +++ b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js @@ -45,11 +45,6 @@ WebInspector.JavaScriptBreakpointsSidebarPane = function(breakpointManager, show this.bodyElement.appendChild(this.emptyElement); this._items = new Map(); - - var breakpointLocations = this._breakpointManager.allBreakpointLocations(); - for (var i = 0; i < breakpointLocations.length; ++i) - this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocations[i].uiLocation); - this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this); this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this); } @@ -64,15 +59,7 @@ WebInspector.JavaScriptBreakpointsSidebarPane.prototype = { var breakpoint = /** @type {WebInspector.BreakpointManager.Breakpoint} */ event.data.breakpoint; var uiLocation = /** @type {WebInspector.UILocation} */ event.data.uiLocation; - this._addBreakpoint(breakpoint, uiLocation); - }, - /** - * @param {WebInspector.BreakpointManager.Breakpoint} breakpoint - * @param {WebInspector.UILocation} uiLocation - */ - _addBreakpoint: function(breakpoint, uiLocation) - { var element = document.createElement("li"); element.addStyleClass("cursor-pointer"); element.addEventListener("contextmenu", this._breakpointContextMenu.bind(this, breakpoint), true); @@ -252,11 +239,11 @@ WebInspector.JavaScriptBreakpointsSidebarPane.prototype = { this.bodyElement.appendChild(this.emptyElement); } this._items.clear(); - }, - - __proto__: WebInspector.SidebarPane.prototype + } } +WebInspector.JavaScriptBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + /** * @constructor * @extends {WebInspector.NativeBreakpointsSidebarPane} @@ -432,11 +419,11 @@ WebInspector.XHRBreakpointsSidebarPane.prototype = { if (breakpoint && typeof breakpoint.url === "string") this._setBreakpoint(breakpoint.url, breakpoint.enabled); } - }, - - __proto__: WebInspector.NativeBreakpointsSidebarPane.prototype + } } +WebInspector.XHRBreakpointsSidebarPane.prototype.__proto__ = WebInspector.NativeBreakpointsSidebarPane.prototype; + /** * @constructor * @extends {WebInspector.SidebarPane} @@ -633,7 +620,7 @@ WebInspector.EventListenerBreakpointsSidebarPane.prototype = { if (breakpoint && typeof breakpoint.eventName === "string") this._setBreakpoint(breakpoint.eventName); } - }, - - __proto__: WebInspector.SidebarPane.prototype + } } + +WebInspector.EventListenerBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/CPUProfileView.js b/Source/WebCore/inspector/front-end/CPUProfileView.js index df8d07d08..641553cd7 100644 --- a/Source/WebCore/inspector/front-end/CPUProfileView.js +++ b/Source/WebCore/inspector/front-end/CPUProfileView.js @@ -531,11 +531,11 @@ WebInspector.CPUProfileView.prototype = { nodesToTraverse.push({ parent: children[i], children: children[i].children }); } } - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.CPUProfileView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.ProfileType} @@ -622,11 +622,11 @@ WebInspector.CPUProfileType.prototype = { createProfile: function(profile) { return new WebInspector.CPUProfileHeader(this, profile.title, profile.uid); - }, - - __proto__: WebInspector.ProfileType.prototype + } } +WebInspector.CPUProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype; + /** * @constructor * @extends {WebInspector.ProfileHeader} @@ -655,7 +655,7 @@ WebInspector.CPUProfileHeader.prototype = { createView: function(profilesPanel) { return new WebInspector.CPUProfileView(this); - }, - - __proto__: WebInspector.ProfileHeader.prototype + } } + +WebInspector.CPUProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype; diff --git a/Source/WebCore/inspector/front-end/CSSCompletions.js b/Source/WebCore/inspector/front-end/CSSCompletions.js index 8c606bed3..9e3798535 100644 --- a/Source/WebCore/inspector/front-end/CSSCompletions.js +++ b/Source/WebCore/inspector/front-end/CSSCompletions.js @@ -90,126 +90,6 @@ WebInspector.CSSCompletions.cssPropertiesMetainfoKeySet = function() return WebInspector.CSSCompletions._cssPropertiesMetainfoKeySet; } -// Weight of CSS properties based their usage on few popular websites https://gist.github.com/3751436 -WebInspector.CSSCompletions.Weight = { - "-webkit-animation": 1, - "-webkit-animation-duration": 1, - "-webkit-animation-iteration-count": 1, - "-webkit-animation-name": 1, - "-webkit-animation-timing-function": 1, - "-webkit-appearance": 1, - "-webkit-background-clip": 2, - "-webkit-border-horizontal-spacing": 1, - "-webkit-border-vertical-spacing": 1, - "-webkit-box-shadow": 24, - "-webkit-font-smoothing": 2, - "-webkit-transform": 1, - "-webkit-transition": 8, - "-webkit-transition-delay": 7, - "-webkit-transition-duration": 7, - "-webkit-transition-property": 7, - "-webkit-transition-timing-function": 6, - "-webkit-user-select": 1, - "background": 222, - "background-attachment": 144, - "background-clip": 143, - "background-color": 222, - "background-image": 201, - "background-origin": 142, - "background-size": 25, - "border": 121, - "border-bottom": 121, - "border-bottom-color": 121, - "border-bottom-left-radius": 50, - "border-bottom-right-radius": 50, - "border-bottom-style": 114, - "border-bottom-width": 120, - "border-collapse": 3, - "border-left": 95, - "border-left-color": 95, - "border-left-style": 89, - "border-left-width": 94, - "border-radius": 50, - "border-right": 93, - "border-right-color": 93, - "border-right-style": 88, - "border-right-width": 93, - "border-top": 111, - "border-top-color": 111, - "border-top-left-radius": 49, - "border-top-right-radius": 49, - "border-top-style": 104, - "border-top-width": 109, - "bottom": 16, - "box-shadow": 25, - "box-sizing": 2, - "clear": 23, - "color": 237, - "cursor": 34, - "direction": 4, - "display": 210, - "fill": 2, - "filter": 1, - "float": 105, - "font": 174, - "font-family": 25, - "font-size": 174, - "font-style": 9, - "font-weight": 89, - "height": 161, - "left": 54, - "letter-spacing": 3, - "line-height": 75, - "list-style": 17, - "list-style-image": 8, - "list-style-position": 8, - "list-style-type": 17, - "margin": 241, - "margin-bottom": 226, - "margin-left": 225, - "margin-right": 213, - "margin-top": 241, - "max-height": 5, - "max-width": 11, - "min-height": 9, - "min-width": 6, - "opacity": 24, - "outline": 10, - "outline-color": 10, - "outline-style": 10, - "outline-width": 10, - "overflow": 57, - "overflow-x": 56, - "overflow-y": 57, - "padding": 216, - "padding-bottom": 208, - "padding-left": 216, - "padding-right": 206, - "padding-top": 216, - "position": 136, - "resize": 1, - "right": 29, - "stroke": 1, - "stroke-width": 1, - "table-layout": 1, - "text-align": 66, - "text-decoration": 53, - "text-indent": 9, - "text-overflow": 8, - "text-shadow": 19, - "text-transform": 5, - "top": 71, - "unicode-bidi": 1, - "vertical-align": 37, - "visibility": 11, - "white-space": 24, - "width": 255, - "word-wrap": 6, - "z-index": 32, - "zoom": 10 -}; - - WebInspector.CSSCompletions.prototype = { startsWith: function(prefix) { @@ -223,22 +103,10 @@ WebInspector.CSSCompletions.prototype = { return results; }, - /** - * @param {Array.<string>} properties - * @return {number} - */ - mostUsedOf: function(properties) + firstStartsWith: function(prefix) { - var maxWeight = 0; - var index = 0; - for (var i = 0; i < properties.length; i++) { - var weight = WebInspector.CSSCompletions.Weight[properties[i]]; - if (weight > maxWeight) { - maxWeight = weight; - index = i; - } - } - return index; + var foundIndex = this._firstIndexOfPrefix(prefix); + return (foundIndex === -1 ? "" : this._values[foundIndex]); }, _firstIndexOfPrefix: function(prefix) diff --git a/Source/WebCore/inspector/front-end/CSSNamedFlowCollectionsView.js b/Source/WebCore/inspector/front-end/CSSNamedFlowCollectionsView.js index b2a302402..239c507b0 100644 --- a/Source/WebCore/inspector/front-end/CSSNamedFlowCollectionsView.js +++ b/Source/WebCore/inspector/front-end/CSSNamedFlowCollectionsView.js @@ -371,11 +371,11 @@ WebInspector.CSSNamedFlowCollectionsView.prototype = { this._tabbedPane.removeEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._tabSelected, this); this._tabbedPane.removeEventListener(WebInspector.TabbedPane.EventTypes.TabClosed, this._tabClosed, this); - }, - - __proto__: WebInspector.SplitView.prototype + } } +WebInspector.CSSNamedFlowCollectionsView.prototype.__proto__ = WebInspector.SplitView.prototype; + /** * @constructor * @extends {TreeElement} @@ -410,7 +410,7 @@ WebInspector.FlowTreeElement.prototype = { } this._overset = newOverset; - }, - - __proto__: TreeElement.prototype + } } + +WebInspector.FlowTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/Source/WebCore/inspector/front-end/CSSNamedFlowView.js b/Source/WebCore/inspector/front-end/CSSNamedFlowView.js index c6a09f208..afb8c1daf 100644 --- a/Source/WebCore/inspector/front-end/CSSNamedFlowView.js +++ b/Source/WebCore/inspector/front-end/CSSNamedFlowView.js @@ -250,7 +250,7 @@ WebInspector.CSSNamedFlowView.prototype = { this._mergeRegions(this._flow.regions, newFlow.regions); this._flow = newFlow; - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.CSSNamedFlowView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js b/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js index e10f8dc6e..70993a2ea 100644 --- a/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js +++ b/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js @@ -74,11 +74,11 @@ WebInspector.CSSSelectorDataGridNode.prototype = { } return cell; - }, - - __proto__: WebInspector.DataGridNode.prototype + } } +WebInspector.CSSSelectorDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; + /** * @constructor * @extends WebInspector.View @@ -259,11 +259,11 @@ WebInspector.CSSSelectorProfileView.prototype = { this.refreshShowAsPercents(); event.consume(true); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.CSSSelectorProfileView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.ProfileType} @@ -364,11 +364,11 @@ WebInspector.CSSSelectorProfileType.prototype = { { title = title || WebInspector.UIString("Recording\u2026"); return new WebInspector.CSSProfileHeader(this, title); - }, - - __proto__: WebInspector.ProfileType.prototype + } } +WebInspector.CSSSelectorProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype; + /** * @constructor @@ -401,7 +401,7 @@ WebInspector.CSSProfileHeader.prototype = { { var profile = /** @type {CSSAgent.SelectorProfile} */this._protocolData; return new WebInspector.CSSSelectorProfileView(profile); - }, - - __proto__: WebInspector.ProfileHeader.prototype + } } + +WebInspector.CSSProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype; diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js index 669e77e1d..e071f60fa 100644 --- a/Source/WebCore/inspector/front-end/CSSStyleModel.js +++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js @@ -38,7 +38,7 @@ WebInspector.CSSStyleModel = function() this._sourceMappings = {}; WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoRequested, this._undoRedoRequested, this); WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this); - this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding(); + this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding(this); this._namedFlowCollections = {}; WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._resetNamedFlowCollections, this); InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this)); @@ -87,8 +87,8 @@ WebInspector.CSSStyleModel.prototype = { /** * @param {function(?*)} userCallback * @param {?Protocol.Error} error - * @param {Array.<CSSAgent.RuleMatch>=} matchedPayload - * @param {Array.<CSSAgent.PseudoIdMatches>=} pseudoPayload + * @param {Array.<CSSAgent.CSSRule>=} matchedPayload + * @param {Array.<CSSAgent.PseudoIdRules>=} pseudoPayload * @param {Array.<CSSAgent.InheritedStyleEntry>=} inheritedPayload */ function callback(userCallback, error, matchedPayload, pseudoPayload, inheritedPayload) @@ -501,11 +501,11 @@ WebInspector.CSSStyleModel.prototype = { { var sourceMapping = this._sourceMappings[rawLocation.url]; return sourceMapping ? sourceMapping.rawLocationToUILocation(rawLocation) : null; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.CSSStyleModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {WebInspector.RawLocation} @@ -1100,59 +1100,30 @@ WebInspector.CSSStyleSheet.prototype = { /** * @constructor */ -WebInspector.CSSStyleModelResourceBinding = function() +WebInspector.CSSStyleModelResourceBinding = function(cssModel) { + this._cssModel = cssModel; this._frameAndURLToStyleSheetId = {}; this._styleSheetIdToHeader = {}; + this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this); WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this); } WebInspector.CSSStyleModelResourceBinding.prototype = { /** - * @param {WebInspector.Resource} resource - * @param {function(?CSSAgent.StyleSheetId)} callback - */ - requestStyleSheetIdForResource: function(resource, callback) - { - function innerCallback() - { - callback(this._styleSheetIdForResource(resource)); - } - - if (this._styleSheetIdForResource(resource)) - innerCallback.call(this); - else - this._loadStyleSheetHeaders(innerCallback.bind(this)); - }, - - /** - * @param {CSSAgent.StyleSheetId} styleSheetId - * @param {function(?string)} callback + * @param {WebInspector.StyleSource} styleSource + * @param {string} content + * @param {boolean} majorChange + * @param {function(?string)} userCallback */ - requestResourceURLForStyleSheetId: function(styleSheetId, callback) + setStyleContent: function(styleSource, content, majorChange, userCallback) { - function innerCallback() - { - var header = this._styleSheetIdToHeader[styleSheetId]; - if (!header) { - callback(null); - return; - } - - var frame = WebInspector.resourceTreeModel.frameForId(header.frameId); - if (!frame) { - callback(null); - return; - } - - var styleSheetURL = header.origin === "inspector" ? this._viaInspectorResourceURL(header.sourceURL) : header.sourceURL; - callback(styleSheetURL); + var resource = styleSource.resource(); + if (this._styleSheetIdForResource(resource)) { + this._innerSetContent(resource, content, majorChange, userCallback, null); + return; } - - if (this._styleSheetIdToHeader[styleSheetId]) - innerCallback.call(this); - else - this._loadStyleSheetHeaders(innerCallback.bind(this)); + this._loadStyleSheetHeaders(this._innerSetContent.bind(this, resource, content, majorChange, userCallback)); }, /** @@ -1175,6 +1146,35 @@ WebInspector.CSSStyleModelResourceBinding.prototype = { }, /** + * @param {WebInspector.Resource} resource + * @param {string} content + * @param {boolean} majorChange + * @param {function(?string)} userCallback + * @param {?string} error + */ + _innerSetContent: function(resource, content, majorChange, userCallback, error) + { + if (error) { + userCallback(error); + return; + } + + var styleSheetId = this._styleSheetIdForResource(resource); + if (!styleSheetId) { + userCallback("No stylesheet found: " + resource.frameId + ":" + resource.url); + return; + } + + this._isSettingContent = true; + function callbackWrapper(error) + { + userCallback(error); + delete this._isSettingContent; + } + this._cssModel.setStyleSheetText(styleSheetId, content, majorChange, callbackWrapper.bind(this)); + }, + + /** * @param {function(?string)} callback */ _loadStyleSheetHeaders: function(callback) @@ -1205,6 +1205,62 @@ WebInspector.CSSStyleModelResourceBinding.prototype = { }, /** + * @param {WebInspector.Event} event + */ + _styleSheetChanged: function(event) + { + if (this._isSettingContent) + return; + + if (!event.data.majorChange) + return; + + /** + * @param {?string} error + * @param {string} content + */ + function callback(error, content) + { + if (!error) + this._innerStyleSheetChanged(event.data.styleSheetId, content); + } + CSSAgent.getStyleSheetText(event.data.styleSheetId, callback.bind(this)); + }, + + /** + * @param {CSSAgent.StyleSheetId} styleSheetId + * @param {string} content + */ + _innerStyleSheetChanged: function(styleSheetId, content) + { + function setContent() + { + var header = this._styleSheetIdToHeader[styleSheetId]; + if (!header) + return; + + var frame = WebInspector.resourceTreeModel.frameForId(header.frameId); + if (!frame) + return; + + var styleSheetURL = header.origin === "inspector" ? this._viaInspectorResourceURL(header.sourceURL) : header.sourceURL; + + var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(styleSheetURL); + if (!uiSourceCode) + return; + + if (uiSourceCode.contentType() === WebInspector.resourceTypes.Stylesheet) + uiSourceCode.addRevision(content); + } + + if (!this._styleSheetIdToHeader[styleSheetId]) { + this._loadStyleSheetHeaders(setContent.bind(this)); + return; + } + setContent.call(this); + }, + + /** * @param {CSSAgent.StyleSheetId} styleSheetId * @param {function(?WebInspector.Resource)} callback */ diff --git a/Source/WebCore/inspector/front-end/CallStackSidebarPane.js b/Source/WebCore/inspector/front-end/CallStackSidebarPane.js index 9c71edb69..5d543f734 100644 --- a/Source/WebCore/inspector/front-end/CallStackSidebarPane.js +++ b/Source/WebCore/inspector/front-end/CallStackSidebarPane.js @@ -155,11 +155,11 @@ WebInspector.CallStackSidebarPane.prototype = { this._selectNextCallFrameOnStack(); event.consume(); } - }, - - __proto__: WebInspector.SidebarPane.prototype + } } +WebInspector.CallStackSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + /** * @constructor * @extends {WebInspector.Placard} @@ -178,7 +178,7 @@ WebInspector.CallStackSidebarPane.Placard = function(callFrame, pane) WebInspector.CallStackSidebarPane.Placard.prototype = { _update: function(uiLocation) { - this.subtitle = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber).trimMiddle(100); + this.subtitle = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber); }, _placardContextMenu: function(event) @@ -197,7 +197,7 @@ WebInspector.CallStackSidebarPane.Placard.prototype = { _restartFrame: function() { this._callFrame.restart(undefined); - }, - - __proto__: WebInspector.Placard.prototype + } } + +WebInspector.CallStackSidebarPane.Placard.prototype.__proto__ = WebInspector.Placard.prototype; diff --git a/Source/WebCore/inspector/front-end/CanvasProfileView.js b/Source/WebCore/inspector/front-end/CanvasProfileView.js index 35d557eef..061ad8a37 100644 --- a/Source/WebCore/inspector/front-end/CanvasProfileView.js +++ b/Source/WebCore/inspector/front-end/CanvasProfileView.js @@ -110,22 +110,17 @@ WebInspector.CanvasProfileView.prototype = { traceLogItem.stepNo = i; traceLogItem.appendChild(document.createTextNode("(" + (i+1) + ") ")); - var sourceText = call.functionName || "context." + call.property; if (call.sourceURL) { // FIXME(62725): stack trace line/column numbers are one-based. var lineNumber = Math.max(0, call.lineNumber - 1) || 0; var columnNumber = Math.max(0, call.columnNumber - 1) || 0; var linkElement = this._linkifier.linkifyLocation(call.sourceURL, lineNumber, columnNumber); - linkElement.textContent = sourceText; + linkElement.textContent = call.functionName; traceLogItem.appendChild(linkElement); } else - traceLogItem.appendChild(document.createTextNode(sourceText)); - - if (call.arguments) - traceLogItem.appendChild(document.createTextNode("(" + call.arguments.join(", ") + ")")); - else - traceLogItem.appendChild(document.createTextNode(" = " + call.value)); + traceLogItem.appendChild(document.createTextNode(call.functionName)); + traceLogItem.appendChild(document.createTextNode("(" + call.arguments.join(", ") + ")")); if (typeof call.result !== "undefined") traceLogItem.appendChild(document.createTextNode(" => " + call.result)); this._traceLogElement.appendChild(traceLogItem); @@ -150,11 +145,11 @@ WebInspector.CanvasProfileView.prototype = { this._replayImageElement.src = dataURL; } CanvasAgent.replayTraceLog(item.traceLogId, item.stepNo, didReplayTraceLog.bind(this)); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.CanvasProfileView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.ProfileType} @@ -232,11 +227,11 @@ WebInspector.CanvasProfileType.prototype = { createProfile: function(profile) { return new WebInspector.CanvasProfileHeader(this, profile.title, -1); - }, - - __proto__: WebInspector.ProfileType.prototype + } } +WebInspector.CanvasProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype; + /** * @constructor * @extends {WebInspector.ProfileHeader} @@ -277,7 +272,7 @@ WebInspector.CanvasProfileHeader.prototype = { createView: function(profilesPanel) { return new WebInspector.CanvasProfileView(this); - }, - - __proto__: WebInspector.ProfileHeader.prototype + } } + +WebInspector.CanvasProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype; diff --git a/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js b/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js index c45784be0..c9fded13b 100644 --- a/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js +++ b/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js @@ -378,7 +378,7 @@ WebInspector.CodeMirrorTextEditor.prototype = { _toRange: function(start, end) { return new WebInspector.TextRange(start.line, start.ch, end.line, end.ch); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.CodeMirrorTextEditor.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/CompilerScriptMapping.js b/Source/WebCore/inspector/front-end/CompilerScriptMapping.js index 05e2b7387..7f4b9dae3 100644 --- a/Source/WebCore/inspector/front-end/CompilerScriptMapping.js +++ b/Source/WebCore/inspector/front-end/CompilerScriptMapping.js @@ -84,7 +84,7 @@ WebInspector.CompilerScriptMapping.prototype = { */ addScript: function(script) { - var originalUISourceCode = new WebInspector.JavaScriptSource(script.sourceURL, script, true); + var originalUISourceCode = new WebInspector.JavaScriptSource(script.sourceURL, null, script, true); this._originalUISourceCodeForScriptId[script.scriptId] = originalUISourceCode; this._scriptForOriginalUISource.put(originalUISourceCode, script); this._workspace.project().addUISourceCode(originalUISourceCode); @@ -109,7 +109,7 @@ WebInspector.CompilerScriptMapping.prototype = { contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, sourceContent); else contentProvider = new WebInspector.CompilerSourceMappingContentProvider(sourceURL); - var uiSourceCode = new WebInspector.JavaScriptSource(sourceURL, contentProvider, false); + var uiSourceCode = new WebInspector.JavaScriptSource(sourceURL, null, contentProvider, false); uiSourceCode.setSourceMapping(this); uiSourceCode.isContentScript = script.isContentScript; this._uiSourceCodeByURL[sourceURL] = uiSourceCode; diff --git a/Source/WebCore/inspector/front-end/ConsoleMessage.js b/Source/WebCore/inspector/front-end/ConsoleMessage.js index df3355a0e..f290a6bad 100644 --- a/Source/WebCore/inspector/front-end/ConsoleMessage.js +++ b/Source/WebCore/inspector/front-end/ConsoleMessage.js @@ -447,11 +447,6 @@ WebInspector.ConsoleMessageImpl.prototype = { return obj.description; } - function styleFormatter(obj) - { - formattedResult.setAttribute("style", obj.description); - } - // Firebug uses %o for formatting objects. formatters.o = parameterFormatter.bind(this, false); formatters.s = valueFormatter; @@ -460,18 +455,15 @@ WebInspector.ConsoleMessageImpl.prototype = { formatters.i = valueFormatter; formatters.d = valueFormatter; - // Firebug uses %c for styling the message. - formatters.c = styleFormatter; - // Support %O to force object formatting, instead of the type-based %o formatting. formatters.O = parameterFormatter.bind(this, true); function append(a, b) { - if (b instanceof Node) - a.appendChild(b); - else if (b) + if (!(b instanceof Node)) a.appendChild(WebInspector.linkifyStringAsFragment(b.toString())); + else + a.appendChild(b); return a; } @@ -695,8 +687,6 @@ WebInspector.ConsoleMessageImpl.prototype = { return false; var l = this._stackTrace; var r = msg._stackTrace; - if (l.length !== r.length) - return false; for (var i = 0; i < l.length; i++) { if (l[i].url !== r[i].url || l[i].functionName !== r[i].functionName || @@ -726,7 +716,7 @@ WebInspector.ConsoleMessageImpl.prototype = { clone: function() { return WebInspector.ConsoleMessage.create(this.source, this.level, this._messageText, this.type, this.url, this.line, this.repeatCount, this._parameters, this._stackTrace, this._request ? this._request.requestId : undefined, this._isOutdated); - }, - - __proto__: WebInspector.ConsoleMessage.prototype + } } + +WebInspector.ConsoleMessageImpl.prototype.__proto__ = WebInspector.ConsoleMessage.prototype; diff --git a/Source/WebCore/inspector/front-end/ConsoleModel.js b/Source/WebCore/inspector/front-end/ConsoleModel.js index fd37e35d9..040296ea7 100644 --- a/Source/WebCore/inspector/front-end/ConsoleModel.js +++ b/Source/WebCore/inspector/front-end/ConsoleModel.js @@ -143,11 +143,11 @@ WebInspector.ConsoleModel.prototype = { msgCopy.repeatDelta = msgCopy.repeatCount; this.addMessage(msgCopy); } - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.ConsoleModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {string} source diff --git a/Source/WebCore/inspector/front-end/ConsolePanel.js b/Source/WebCore/inspector/front-end/ConsolePanel.js index c6e7c2b67..8012b19c1 100644 --- a/Source/WebCore/inspector/front-end/ConsolePanel.js +++ b/Source/WebCore/inspector/front-end/ConsolePanel.js @@ -150,7 +150,7 @@ WebInspector.ConsolePanel.prototype = { this._searchResults.length = 0; if (this.isShowing()) WebInspector.searchController.updateSearchMatchesCount(0, this); - }, - - __proto__: WebInspector.Panel.prototype + } } + +WebInspector.ConsolePanel.prototype.__proto__ = WebInspector.Panel.prototype; diff --git a/Source/WebCore/inspector/front-end/ConsoleView.js b/Source/WebCore/inspector/front-end/ConsoleView.js index eeb5cf2de..04011165a 100644 --- a/Source/WebCore/inspector/front-end/ConsoleView.js +++ b/Source/WebCore/inspector/front-end/ConsoleView.js @@ -27,6 +27,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +const ExpressionStopCharacters = " =:[({;,!+-*/&|^<>"; + /** * @extends {WebInspector.View} * @constructor @@ -112,7 +114,7 @@ WebInspector.ConsoleView = function(hideContextSelector) this._linkifier = new WebInspector.Linkifier(); - this.prompt = new WebInspector.TextPromptWithHistory(WebInspector.runtimeModel.completionsForTextPrompt.bind(WebInspector.runtimeModel)); + this.prompt = new WebInspector.TextPromptWithHistory(this.completionsForTextPrompt.bind(this), ExpressionStopCharacters + "."); this.prompt.setSuggestBoxEnabled("generic-suggest"); this.prompt.renderAsBlock(); this.prompt.attach(this.promptElement); @@ -174,14 +176,14 @@ WebInspector.ConsoleView.prototype = { { var context = this._currentFrame(); if (!context) { - WebInspector.runtimeModel.setCurrentExecutionContext(null); + delete this._currentExecutionContext; this._contextSelector.element.addStyleClass("hidden"); return; } var executionContexts = context.executionContexts(); if (executionContexts.length) - WebInspector.runtimeModel.setCurrentExecutionContext(executionContexts[0]); + this._currentExecutionContext = executionContexts[0]; if (executionContexts.length === 1) { this._contextSelector.element.addStyleClass("hidden"); @@ -198,8 +200,8 @@ WebInspector.ConsoleView.prototype = { */ _appendContextOption: function(executionContext) { - if (!WebInspector.runtimeModel.currentExecutionContext()) - WebInspector.runtimeModel.setCurrentExecutionContext(executionContext); + if (!this._currentExecutionContext) + this._currentExecutionContext = executionContext; var option = document.createElement("option"); option.text = executionContext.name; option.title = executionContext.id; @@ -213,7 +215,7 @@ WebInspector.ConsoleView.prototype = { _contextChanged: function(event) { var option = this._contextSelector.selectedOption(); - WebInspector.runtimeModel.setCurrentExecutionContext(option ? option._executionContext : null); + this._currentExecutionContext = option ? option._executionContext : undefined; }, /** @@ -430,6 +432,143 @@ WebInspector.ConsoleView.prototype = { this._linkifier.reset(); }, + completionsForTextPrompt: function(textPrompt, wordRange, force, completionsReadyCallback) + { + // Pass less stop characters to rangeOfWord so the range will be a more complete expression. + var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOffset, ExpressionStopCharacters, textPrompt.proxyElement, "backward"); + var expressionString = expressionRange.toString(); + var prefix = wordRange.toString(); + this.completionsForExpression(expressionString, prefix, force, completionsReadyCallback); + }, + + completionsForExpression: function(expressionString, prefix, force, completionsReadyCallback) + { + var lastIndex = expressionString.length - 1; + + var dotNotation = (expressionString[lastIndex] === "."); + var bracketNotation = (expressionString[lastIndex] === "["); + + if (dotNotation || bracketNotation) + expressionString = expressionString.substr(0, lastIndex); + + if (expressionString && parseInt(expressionString, 10) == expressionString) { + // User is entering float value, do not suggest anything. + completionsReadyCallback([]); + return; + } + + if (!prefix && !expressionString && !force) { + completionsReadyCallback([]); + return; + } + + if (!expressionString && WebInspector.debuggerModel.selectedCallFrame()) + WebInspector.debuggerModel.getSelectedCallFrameVariables(receivedPropertyNames.bind(this)); + else + this.evalInInspectedWindow(expressionString, "completion", true, true, false, evaluated.bind(this)); + + function evaluated(result, wasThrown) + { + if (!result || wasThrown) { + completionsReadyCallback([]); + return; + } + + function getCompletions(primitiveType) + { + var object; + if (primitiveType === "string") + object = new String(""); + else if (primitiveType === "number") + object = new Number(0); + else if (primitiveType === "boolean") + object = new Boolean(false); + else + object = this; + + var resultSet = {}; + for (var o = object; o; o = o.__proto__) { + try { + var names = Object.getOwnPropertyNames(o); + for (var i = 0; i < names.length; ++i) + resultSet[names[i]] = true; + } catch (e) { + } + } + return resultSet; + } + + if (result.type === "object" || result.type === "function") + result.callFunctionJSON(getCompletions, undefined, receivedPropertyNames.bind(this)); + else if (result.type === "string" || result.type === "number" || result.type === "boolean") + this.evalInInspectedWindow("(" + getCompletions + ")(\"" + result.type + "\")", "completion", false, true, true, receivedPropertyNamesFromEval.bind(this)); + } + + function receivedPropertyNamesFromEval(notRelevant, wasThrown, result) + { + if (result && !wasThrown) + receivedPropertyNames.call(this, result.value); + else + completionsReadyCallback([]); + } + + function receivedPropertyNames(propertyNames) + { + RuntimeAgent.releaseObjectGroup("completion"); + if (!propertyNames) { + completionsReadyCallback([]); + return; + } + var includeCommandLineAPI = (!dotNotation && !bracketNotation); + if (includeCommandLineAPI) { + const commandLineAPI = ["dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear"]; + for (var i = 0; i < commandLineAPI.length; ++i) + propertyNames[commandLineAPI[i]] = true; + } + this._reportCompletions(completionsReadyCallback, dotNotation, bracketNotation, expressionString, prefix, Object.keys(propertyNames)); + } + }, + + _reportCompletions: function(completionsReadyCallback, dotNotation, bracketNotation, expressionString, prefix, properties) { + if (bracketNotation) { + if (prefix.length && prefix[0] === "'") + var quoteUsed = "'"; + else + var quoteUsed = "\""; + } + + var results = []; + + if (!expressionString) { + const keywords = ["break", "case", "catch", "continue", "default", "delete", "do", "else", "finally", "for", "function", "if", "in", + "instanceof", "new", "return", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with"]; + properties = properties.concat(keywords); + } + + properties.sort(); + + for (var i = 0; i < properties.length; ++i) { + var property = properties[i]; + + if (dotNotation && !/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(property)) + continue; + + if (bracketNotation) { + if (!/^[0-9]+$/.test(property)) + property = quoteUsed + property.escapeCharacters(quoteUsed + "\\") + quoteUsed; + property += "]"; + } + + if (property.length < prefix.length) + continue; + if (prefix.length && !property.startsWith(prefix)) + continue; + + results.push(property); + } + completionsReadyCallback(results); + }, + _handleContextMenuEvent: function(event) { if (!window.getSelection().isCollapsed) { @@ -533,6 +672,47 @@ WebInspector.ConsoleView.prototype = { } }, + /** + * @param {string} expression + * @param {string} objectGroup + * @param {boolean} includeCommandLineAPI + * @param {boolean} doNotPauseOnExceptionsAndMuteConsole + * @param {boolean} returnByValue + * @param {function(?WebInspector.RemoteObject, boolean, RuntimeAgent.RemoteObject=)} callback + */ + evalInInspectedWindow: function(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, callback) + { + if (WebInspector.debuggerModel.selectedCallFrame()) { + WebInspector.debuggerModel.evaluateOnSelectedCallFrame(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, callback); + return; + } + + if (!expression) { + // There is no expression, so the completion should happen against global properties. + expression = "this"; + } + + /** + * @param {?Protocol.Error} error + * @param {RuntimeAgent.RemoteObject} result + * @param {boolean=} wasThrown + */ + function evalCallback(error, result, wasThrown) + { + if (error) { + console.error(error); + callback(null, false); + return; + } + + if (returnByValue) + callback(null, !!wasThrown, wasThrown ? null : result); + else + callback(WebInspector.RemoteObject.fromPayload(result), !!wasThrown); + } + RuntimeAgent.evaluate(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, this._currentExecutionContext ? this._currentExecutionContext.id : undefined, returnByValue, evalCallback); + }, + evaluateUsingTextPrompt: function(expression, showResultOnly) { this._appendCommand(expression, this.prompt.text, false, showResultOnly); @@ -553,6 +733,27 @@ WebInspector.ConsoleView.prototype = { this._appendCommand(str, "", true, false); }, + runScript: function(scriptId) + { + DebuggerAgent.runScript(scriptId, this._currentExecutionContext ? this._currentExecutionContext.id : undefined, "console", false, runCallback.bind(this)); + WebInspector.userMetrics.ConsoleEvaluated.record(); + + /** + * @param {?string} error + * @param {?RuntimeAgent.RemoteObject} result + * @param {boolean=} wasThrown + */ + function runCallback(error, result, wasThrown) + { + if (error) { + console.error(error); + return; + } + + this._printResult(result, wasThrown, null); + } + }, + _printResult: function(result, wasThrown, originatingCommand) { if (!result) @@ -582,7 +783,7 @@ WebInspector.ConsoleView.prototype = { this._printResult(result, wasThrown, commandMessage); } - WebInspector.runtimeModel.evaluate(text, "console", useCommandLineAPI, false, false, printResult.bind(this)); + this.evalInInspectedWindow(text, "console", useCommandLineAPI, false, false, printResult.bind(this)); WebInspector.userMetrics.ConsoleEvaluated.record(); }, @@ -628,11 +829,11 @@ WebInspector.ConsoleView.prototype = { WebInspector.log(counter > 1 ? counter + " x " + previousTitle : previousTitle); } MemoryAgent.getDOMNodeCount(callback); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.ConsoleView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor */ @@ -709,11 +910,11 @@ WebInspector.ConsoleCommandResult.prototype = { var element = WebInspector.ConsoleMessageImpl.prototype.toMessageElement.call(this); element.addStyleClass("console-user-command-result"); return element; - }, - - __proto__: WebInspector.ConsoleMessageImpl.prototype + } } +WebInspector.ConsoleCommandResult.prototype.__proto__ = WebInspector.ConsoleMessageImpl.prototype; + /** * @constructor */ diff --git a/Source/WebCore/inspector/front-end/ContentProvider.js b/Source/WebCore/inspector/front-end/ContentProvider.js index 47f2a8d3a..2c6f5198c 100644 --- a/Source/WebCore/inspector/front-end/ContentProvider.js +++ b/Source/WebCore/inspector/front-end/ContentProvider.js @@ -35,7 +35,7 @@ WebInspector.ContentProvider = function() { } WebInspector.ContentProvider.prototype = { /** - * @return {string} + * @return {?string} */ contentURL: function() { }, diff --git a/Source/WebCore/inspector/front-end/ContentProviders.js b/Source/WebCore/inspector/front-end/ContentProviders.js index 54530dfaa..9c19953dd 100644 --- a/Source/WebCore/inspector/front-end/ContentProviders.js +++ b/Source/WebCore/inspector/front-end/ContentProviders.js @@ -73,11 +73,11 @@ WebInspector.ConcatenatedScriptsContentProvider.prototype = { }, /** - * @return {string} + * @return {?string} */ contentURL: function() { - return ""; + return null; }, /** @@ -177,14 +177,13 @@ WebInspector.ConcatenatedScriptsContentProvider.prototype = { } return content; - }, - - __proto__: WebInspector.ContentProvider.prototype + } } +WebInspector.ConcatenatedScriptsContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype; + /** * @constructor - * @param {string} sourceURL * @implements {WebInspector.ContentProvider} */ WebInspector.CompilerSourceMappingContentProvider = function(sourceURL) @@ -194,7 +193,7 @@ WebInspector.CompilerSourceMappingContentProvider = function(sourceURL) WebInspector.CompilerSourceMappingContentProvider.prototype = { /** - * @return {string} + * @return {?string} */ contentURL: function() { @@ -233,11 +232,11 @@ WebInspector.CompilerSourceMappingContentProvider.prototype = { searchInContent: function(query, caseSensitive, isRegex, callback) { callback([]); - }, - - __proto__: WebInspector.ContentProvider.prototype + } } +WebInspector.CompilerSourceMappingContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype; + /** * @constructor * @implements {WebInspector.ContentProvider} @@ -254,11 +253,11 @@ WebInspector.StaticContentProvider = function(contentType, content, mimeType) WebInspector.StaticContentProvider.prototype = { /** - * @return {string} + * @return {?string} */ contentURL: function() { - return ""; + return null; }, /** @@ -306,7 +305,7 @@ WebInspector.StaticContentProvider.prototype = { // searchInContent should call back later. window.setTimeout(performSearch.bind(this), 0); - }, - - __proto__: WebInspector.ContentProvider.prototype + } } + +WebInspector.StaticContentProvider.prototype.__proto__ = WebInspector.ContentProvider.prototype; diff --git a/Source/WebCore/inspector/front-end/ContextMenu.js b/Source/WebCore/inspector/front-end/ContextMenu.js index deecc274e..6821c4a9a 100644 --- a/Source/WebCore/inspector/front-end/ContextMenu.js +++ b/Source/WebCore/inspector/front-end/ContextMenu.js @@ -143,11 +143,11 @@ WebInspector.ContextSubMenuItem.prototype = { for (var i = 0; i < this._items.length; ++i) result.subItems.push(this._items[i]._buildDescriptor()); return result; - }, - - __proto__: WebInspector.ContextMenuItem.prototype + } } +WebInspector.ContextSubMenuItem.prototype.__proto__ = WebInspector.ContextMenuItem.prototype; + /** * @constructor * @extends {WebInspector.ContextSubMenuItem} @@ -206,11 +206,11 @@ WebInspector.ContextMenu.prototype = { provider.appendApplicableItems(this, target); this.appendSeparator(); } - }, - - __proto__: WebInspector.ContextSubMenuItem.prototype + } } +WebInspector.ContextMenu.prototype.__proto__ = WebInspector.ContextSubMenuItem.prototype; + /** * @interface */ diff --git a/Source/WebCore/inspector/front-end/CookieItemsView.js b/Source/WebCore/inspector/front-end/CookieItemsView.js index 9fa23547a..1698d3253 100644 --- a/Source/WebCore/inspector/front-end/CookieItemsView.js +++ b/Source/WebCore/inspector/front-end/CookieItemsView.js @@ -155,11 +155,11 @@ WebInspector.CookieItemsView.prototype = { contextMenu.appendItem(WebInspector.UIString("Refresh"), this._update.bind(this)); contextMenu.show(event); } - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.View} @@ -197,7 +197,60 @@ WebInspector.SimpleCookiesTable.prototype = { this._dataGrid.rootNode().appendChild(node); } this._dataGrid.rootNode().children[0].selected = true; - }, + } +} + +WebInspector.SimpleCookiesTable.prototype.__proto__ = WebInspector.View.prototype; - __proto__: WebInspector.View.prototype +WebInspector.Cookies = {} + +WebInspector.Cookies.getCookiesAsync = function(callback) +{ + function mycallback(error, cookies, cookiesString) + { + if (error) + return; + if (cookiesString) + callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false); + else + callback(cookies, true); + } + + PageAgent.getCookies(mycallback); +} + +WebInspector.Cookies.buildCookiesFromString = function(rawCookieString) +{ + var rawCookies = rawCookieString.split(/;\s*/); + var cookies = []; + + if (!(/^\s*$/.test(rawCookieString))) { + for (var i = 0; i < rawCookies.length; ++i) { + var cookie = rawCookies[i]; + var delimIndex = cookie.indexOf("="); + var name = cookie.substring(0, delimIndex); + var value = cookie.substring(delimIndex + 1); + var size = name.length + value.length; + cookies.push({ name: name, value: value, size: size }); + } + } + + return cookies; +} + +WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) +{ + var url = resourceURL.asParsedURL(); + if (!url || !WebInspector.Cookies.cookieDomainMatchesResourceDomain(cookie.domain, url.host)) + return false; + return (url.path.startsWith(cookie.path) + && (!cookie.port || url.port == cookie.port) + && (!cookie.secure || url.scheme === "https")); +} + +WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain) +{ + if (cookieDomain.charAt(0) !== '.') + return resourceDomain === cookieDomain; + return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i"); } diff --git a/Source/WebCore/inspector/front-end/CookieParser.js b/Source/WebCore/inspector/front-end/CookieParser.js index a369ac8d9..b61937710 100644 --- a/Source/WebCore/inspector/front-end/CookieParser.js +++ b/Source/WebCore/inspector/front-end/CookieParser.js @@ -255,8 +255,16 @@ WebInspector.Cookie.prototype = { */ expires: function(requestDate) { - return this._attributes["expires"] ? new Date(this._attributes["expires"]) : - (this._attributes["max-age"] ? new Date(requestDate.getTime() + 1000 * this._attributes["max-age"]) : null); + // RFC 6265 indicates that the max-age attribute takes precedence over the expires attribute + if (this._attributes["max-age"]) { + var targetDate = requestDate === null ? new Date() : requestDate; + return new Date(targetDate.getTime() + 1000 * this._attributes["max-age"]); + } + + if (this._attributes["expires"]) + return new Date(this._attributes["expires"]); + + return null; }, /** @@ -281,56 +289,3 @@ WebInspector.Cookie.Type = { Request: 0, Response: 1 }; - -WebInspector.Cookies = {} - -WebInspector.Cookies.getCookiesAsync = function(callback) -{ - function mycallback(error, cookies, cookiesString) - { - if (error) - return; - if (cookiesString) - callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false); - else - callback(cookies, true); - } - - PageAgent.getCookies(mycallback); -} - -WebInspector.Cookies.buildCookiesFromString = function(rawCookieString) -{ - var rawCookies = rawCookieString.split(/;\s*/); - var cookies = []; - - if (!(/^\s*$/.test(rawCookieString))) { - for (var i = 0; i < rawCookies.length; ++i) { - var cookie = rawCookies[i]; - var delimIndex = cookie.indexOf("="); - var name = cookie.substring(0, delimIndex); - var value = cookie.substring(delimIndex + 1); - var size = name.length + value.length; - cookies.push({ name: name, value: value, size: size }); - } - } - - return cookies; -} - -WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) -{ - var url = resourceURL.asParsedURL(); - if (!url || !WebInspector.Cookies.cookieDomainMatchesResourceDomain(cookie.domain, url.host)) - return false; - return (url.path.startsWith(cookie.path) - && (!cookie.port || url.port == cookie.port) - && (!cookie.secure || url.scheme === "https")); -} - -WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain) -{ - if (cookieDomain.charAt(0) !== '.') - return resourceDomain === cookieDomain; - return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i"); -} diff --git a/Source/WebCore/inspector/front-end/CookiesTable.js b/Source/WebCore/inspector/front-end/CookiesTable.js index 706b78b8e..881e9e668 100644 --- a/Source/WebCore/inspector/front-end/CookiesTable.js +++ b/Source/WebCore/inspector/front-end/CookiesTable.js @@ -202,7 +202,7 @@ WebInspector.CookiesTable.prototype = { data[2] = cookie.domain || ""; data[3] = cookie.path || ""; data[4] = cookie.type === WebInspector.Cookie.Type.Request ? "" : - (cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString()); + (cookie.session ? WebInspector.UIString("Session") : cookie.expires().toUTCString()); data[5] = cookie.size; const checkmark = "\u2713"; data[6] = (cookie.httpOnly ? checkmark : ""); @@ -217,7 +217,7 @@ WebInspector.CookiesTable.prototype = { _onDeleteFromGrid: function(deleteCallback, node) { deleteCallback(node.cookie); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.CookiesTable.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/DOMAgent.js b/Source/WebCore/inspector/front-end/DOMAgent.js index f39a3cbb8..5f4f06162 100644 --- a/Source/WebCore/inspector/front-end/DOMAgent.js +++ b/Source/WebCore/inspector/front-end/DOMAgent.js @@ -67,14 +67,6 @@ WebInspector.DOMNode = function(domAgent, doc, isInShadowTree, payload) { this.lastChild = null; this.parentNode = null; - if (payload.shadowRoots && WebInspector.settings.showShadowDOM.get()) { - for (var i = 0; i < payload.shadowRoots.length; ++i) { - var root = payload.shadowRoots[i]; - var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, true, root); - this._shadowRoots.push(node); - } - } - if (payload.children) this._setChildrenPayload(payload.children); @@ -84,6 +76,14 @@ WebInspector.DOMNode = function(domAgent, doc, isInShadowTree, payload) { this._renumber(); } + if (payload.shadowRoots && WebInspector.experimentsSettings.showShadowDOM.isEnabled()) { + for (var i = 0; i < payload.shadowRoots.length; ++i) { + var root = payload.shadowRoots[i]; + var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, true, root); + this._shadowRoots.push(node); + } + } + if (this._nodeType === Node.ELEMENT_NODE) { // HTML and BODY from internal iframes should not overwrite top-level ones. if (this.ownerDocument && !this.ownerDocument.documentElement && this._nodeName === "HTML") @@ -136,14 +136,6 @@ WebInspector.DOMNode.prototype = { }, /** - * @return {boolean} - */ - hasShadowRoots: function() - { - return !!this._shadowRoots.length; - }, - - /** * @return {number} */ nodeType: function() @@ -772,15 +764,12 @@ WebInspector.DOMDocument = function(domAgent, payload) { WebInspector.DOMNode.call(this, domAgent, this, false, payload); this.documentURL = payload.documentURL || ""; - this.baseURL = /** @type {string} */ payload.baseURL; - console.assert(this.baseURL); + this.baseURL = payload.baseURL; this.xmlVersion = payload.xmlVersion; this._listeners = {}; } -WebInspector.DOMDocument.prototype = { - __proto__: WebInspector.DOMNode.prototype -} +WebInspector.DOMDocument.prototype.__proto__ = WebInspector.DOMNode.prototype; /** * @extends {WebInspector.Object} @@ -1343,11 +1332,11 @@ WebInspector.DOMAgent.prototype = { this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoRequested); DOMAgent.redo(callback); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.DOMAgent.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {DOMAgent.Dispatcher} diff --git a/Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js b/Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js index c1b355e90..abd75baca 100644 --- a/Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js +++ b/Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js @@ -323,7 +323,7 @@ WebInspector.DOMBreakpointsSidebarPane.prototype = { } pathToBreakpoints[path].push(breakpoint); } - }, - - __proto__: WebInspector.NativeBreakpointsSidebarPane.prototype + } } + +WebInspector.DOMBreakpointsSidebarPane.prototype.__proto__ = WebInspector.NativeBreakpointsSidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/DOMExtension.js b/Source/WebCore/inspector/front-end/DOMExtension.js index c8eea3642..3e5926409 100644 --- a/Source/WebCore/inspector/front-end/DOMExtension.js +++ b/Source/WebCore/inspector/front-end/DOMExtension.js @@ -177,7 +177,7 @@ Element.prototype.pruneEmptyTextNodes = function() var sibling = this.firstChild; while (sibling) { var nextSibling = sibling.nextSibling; - if (sibling.nodeType === Node.TEXT_NODE && sibling.nodeValue === "") + if (sibling.nodeType === this.TEXT_NODE && sibling.nodeValue === "") this.removeChild(sibling); sibling = nextSibling; } diff --git a/Source/WebCore/inspector/front-end/DOMStorage.js b/Source/WebCore/inspector/front-end/DOMStorage.js index 7af442b2d..df977711a 100644 --- a/Source/WebCore/inspector/front-end/DOMStorage.js +++ b/Source/WebCore/inspector/front-end/DOMStorage.js @@ -135,11 +135,11 @@ WebInspector.DOMStorageModel.prototype = { for (var storageId in this._storages) result.push(this._storages[storageId]); return result; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.DOMStorageModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {DOMStorageAgent.Dispatcher} diff --git a/Source/WebCore/inspector/front-end/DOMStorageItemsView.js b/Source/WebCore/inspector/front-end/DOMStorageItemsView.js index 883fa7342..d0bffb628 100644 --- a/Source/WebCore/inspector/front-end/DOMStorageItemsView.js +++ b/Source/WebCore/inspector/front-end/DOMStorageItemsView.js @@ -149,7 +149,7 @@ WebInspector.DOMStorageItemsView.prototype = { this.domStorage.removeItem(node.data[0]); this.update(); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.DOMStorageItemsView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/DataGrid.js b/Source/WebCore/inspector/front-end/DataGrid.js index 114d82d90..09790f5e2 100644 --- a/Source/WebCore/inspector/front-end/DataGrid.js +++ b/Source/WebCore/inspector/front-end/DataGrid.js @@ -1000,8 +1000,6 @@ WebInspector.DataGrid.prototype = { ColumnResizePadding: 10, CenterResizerOverBorderAdjustment: 3, - - __proto__: WebInspector.View.prototype } WebInspector.DataGrid.ResizeMethod = { @@ -1010,6 +1008,8 @@ WebInspector.DataGrid.ResizeMethod = { Last: "last" } +WebInspector.DataGrid.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.Object} @@ -1635,11 +1635,11 @@ WebInspector.DataGridNode.prototype = { this._savedPosition.parent.insertChild(this, this._savedPosition.index); delete this._savedPosition; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.DataGridNode.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @extends {WebInspector.DataGridNode} @@ -1655,7 +1655,7 @@ WebInspector.CreationDataGridNode.prototype = { { delete this.isCreationNode; delete this.makeNormal; - }, - - __proto__: WebInspector.DataGridNode.prototype + } } + +WebInspector.CreationDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; diff --git a/Source/WebCore/inspector/front-end/Database.js b/Source/WebCore/inspector/front-end/Database.js index 9758c25aa..caaedb587 100644 --- a/Source/WebCore/inspector/front-end/Database.js +++ b/Source/WebCore/inspector/front-end/Database.js @@ -171,11 +171,11 @@ WebInspector.DatabaseModel.prototype = { { this._databases.push(database); this.dispatchEventToListeners(WebInspector.DatabaseModel.Events.DatabaseAdded, database); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.DatabaseModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {DatabaseAgent.Dispatcher} diff --git a/Source/WebCore/inspector/front-end/DatabaseQueryView.js b/Source/WebCore/inspector/front-end/DatabaseQueryView.js index 374b66dc8..db06c1cb2 100644 --- a/Source/WebCore/inspector/front-end/DatabaseQueryView.js +++ b/Source/WebCore/inspector/front-end/DatabaseQueryView.js @@ -46,7 +46,7 @@ WebInspector.DatabaseQueryView = function(database) this.prompt = new WebInspector.TextPromptWithHistory(this.completions.bind(this), " "); this.prompt.attach(this._promptElement); - + this.element.addEventListener("click", this._messagesClicked.bind(this), true); } @@ -61,13 +61,7 @@ WebInspector.DatabaseQueryView.prototype = { this.prompt.moveCaretToEndOfPrompt(); }, - /** - * @param {Element} proxyElement - * @param {Range} wordRange - * @param {boolean} force - * @param {function(Array.<string>, number=)} completionsReadyCallback - */ - completions: function(proxyElement, wordRange, force, completionsReadyCallback) + completions: function(textPrompt, wordRange, force, completionsReadyCallback) { var prefix = wordRange.toString().toLowerCase(); if (!prefix.length && !force) @@ -199,7 +193,7 @@ WebInspector.DatabaseQueryView.prototype = { resultElement.className = "database-query-result"; element.appendChild(resultElement); return resultElement; - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.DatabaseQueryView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/DatabaseTableView.js b/Source/WebCore/inspector/front-end/DatabaseTableView.js index 0d5e5f832..fec50cdf5 100644 --- a/Source/WebCore/inspector/front-end/DatabaseTableView.js +++ b/Source/WebCore/inspector/front-end/DatabaseTableView.js @@ -95,7 +95,7 @@ WebInspector.DatabaseTableView.prototype = { _refreshButtonClicked: function(event) { this.update(); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.DatabaseTableView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/DebuggerModel.js b/Source/WebCore/inspector/front-end/DebuggerModel.js index 326a9be24..21fb45ba1 100644 --- a/Source/WebCore/inspector/front-end/DebuggerModel.js +++ b/Source/WebCore/inspector/front-end/DebuggerModel.js @@ -371,12 +371,10 @@ WebInspector.DebuggerModel.prototype = { * @param {number} endLine * @param {number} endColumn * @param {boolean} isContentScript - * @param {string=} sourceMapURL - * @param {boolean=} hasSourceURL */ - _parsedScriptSource: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL) + _parsedScriptSource: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL) { - var script = new WebInspector.Script(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL); + var script = new WebInspector.Script(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL); this._registerScript(script); this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource, script); }, @@ -588,11 +586,11 @@ WebInspector.DebuggerModel.prototype = { this._pausedScript(newCallFrames, this._debuggerPausedDetails.reason, this._debuggerPausedDetails.auxData); } - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.DebuggerModel.prototype.__proto__ = WebInspector.Object.prototype; + WebInspector.DebuggerEventTypes = { JavaScriptPause: 0, JavaScriptBreakpoint: 1, @@ -639,11 +637,10 @@ WebInspector.DebuggerDispatcher.prototype = { * @param {number} endColumn * @param {boolean=} isContentScript * @param {string=} sourceMapURL - * @param {boolean=} hasSourceURL */ - scriptParsed: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL) + scriptParsed: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL) { - this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, !!isContentScript, sourceMapURL, hasSourceURL); + this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, !!isContentScript, sourceMapURL); }, /** diff --git a/Source/WebCore/inspector/front-end/DefaultTextEditor.js b/Source/WebCore/inspector/front-end/DefaultTextEditor.js index a41dd8028..69c87ce12 100644 --- a/Source/WebCore/inspector/front-end/DefaultTextEditor.js +++ b/Source/WebCore/inspector/front-end/DefaultTextEditor.js @@ -574,11 +574,11 @@ WebInspector.DefaultTextEditor.prototype = { if (!this.readOnly()) WebInspector.markBeingEdited(this.element, false); this._freeCachedElements(); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.DefaultTextEditor.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @param {WebInspector.TextEditorModel} textModel @@ -1061,11 +1061,11 @@ WebInspector.TextEditorGutterPanel.prototype = { if (!decorations.length) delete this._decorations[lineNumber]; } - }, - - __proto__: WebInspector.TextEditorChunkedPanel.prototype + } } +WebInspector.TextEditorGutterPanel.prototype.__proto__ = WebInspector.TextEditorChunkedPanel.prototype; + /** * @constructor */ @@ -1563,10 +1563,11 @@ WebInspector.TextEditorMainPanel.prototype = { if (lineNumber === range.startLine) newRange.startColumn = Math.max(0, newRange.startColumn - lineIndentLength); - if (lineNumber === range.endLine) - newRange.endColumn = Math.max(0, newRange.endColumn - lineIndentLength); } + if (lineIndentLength) + newRange.endColumn = Math.max(0, newRange.endColumn - lineIndentLength); + this._lastEditedRange = newRange; return newRange; @@ -2029,7 +2030,7 @@ WebInspector.TextEditorMainPanel.prototype = { var rangeBoundary = lineRow.rangeBoundaryForOffset(column); else { var offset = column; - for (var i = chunk.startLine; i < line && i < this._textModel.linesCount; ++i) + for (var i = chunk.startLine; i < line; ++i) offset += this._textModel.lineLength(i) + 1; // \n lineRow = chunk.element; if (lineRow.firstChild) @@ -2508,11 +2509,11 @@ WebInspector.TextEditorMainPanel.prototype = { textContents = textContent.split("\n"); for (var i = 0; i < textContents.length; ++i) lines.push(textContents[i]); - }, - - __proto__: WebInspector.TextEditorChunkedPanel.prototype + } } +WebInspector.TextEditorMainPanel.prototype.__proto__ = WebInspector.TextEditorChunkedPanel.prototype; + /** * @constructor * @param {WebInspector.TextEditorChunkedPanel} chunkedPanel diff --git a/Source/WebCore/inspector/front-end/Dialog.js b/Source/WebCore/inspector/front-end/Dialog.js index eb5797dc8..634e1fcc9 100644 --- a/Source/WebCore/inspector/front-end/Dialog.js +++ b/Source/WebCore/inspector/front-end/Dialog.js @@ -178,8 +178,7 @@ WebInspector.DialogDelegate.prototype = { onEnter: function() { }, - willHide: function() { }, - - __proto__: WebInspector.Object.prototype -} + willHide: function() { } +}; +WebInspector.DialogDelegate.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/DirectoryContentView.js b/Source/WebCore/inspector/front-end/DirectoryContentView.js index 144260fcb..21ced2515 100644 --- a/Source/WebCore/inspector/front-end/DirectoryContentView.js +++ b/Source/WebCore/inspector/front-end/DirectoryContentView.js @@ -86,11 +86,11 @@ WebInspector.DirectoryContentView.prototype = { { var column = /** @type {string} */ this.sortColumnIdentifier; this.sortNodes(WebInspector.DirectoryContentView.Node.comparator(column, this.sortOrder === "descending"), false); - }, - - __proto__: WebInspector.DataGrid.prototype + } } +WebInspector.DirectoryContentView.prototype.__proto__ = WebInspector.DataGrid.prototype; + /** * @constructor * @extends {WebInspector.DataGridNode} @@ -193,7 +193,7 @@ WebInspector.DirectoryContentView.Node.prototype = { data[indexes.Size] = Number.bytesToString(metadata.size); data[indexes.ModificationTime] = new Date(metadata.modificationTime).toGMTString(); this.data = data; - }, - - __proto__: WebInspector.DataGridNode.prototype + } } + +WebInspector.DirectoryContentView.Node.prototype.__proto__ = WebInspector.DataGridNode.prototype; diff --git a/Source/WebCore/inspector/front-end/DockController.js b/Source/WebCore/inspector/front-end/DockController.js deleted file mode 100644 index 56694686f..000000000 --- a/Source/WebCore/inspector/front-end/DockController.js +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS 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 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. - */ - -/** - * @constructor - */ -WebInspector.DockController = function() -{ - this._dockToggleButton = new WebInspector.StatusBarButton("", "dock-status-bar-item", 3); - this._dockToggleButtonOption = new WebInspector.StatusBarButton("", "dock-status-bar-item", 3); - this._dockToggleButton.addEventListener("click", this._toggleDockState, this); - this._dockToggleButtonOption.addEventListener("click", this._toggleDockState, this); - if (Preferences.showDockToRight) - this._dockToggleButton.makeLongClickEnabled(this._createDockOptions.bind(this)); - - this._dockSide = WebInspector.queryParamsObject["dockSide"]; - this._innerSetDocked(WebInspector.queryParamsObject["docked"] === "true"); -} - -WebInspector.DockController.State = { - DockedToBottom: "bottom", - DockedToRight: "right", - Undocked: "undocked" -} - -WebInspector.DockController.prototype = { - /** - * @return {Element} - */ - get element() - { - return this._dockToggleButton.element; - }, - - /** - * @param {boolean} docked - */ - setDocked: function(docked) - { - var isDocked = this._state !== WebInspector.DockController.State.Undocked; - if (docked !== isDocked) - this._innerSetDocked(docked); - }, - - /** - * @param {boolean} docked - */ - _innerSetDocked: function(docked) - { - if (this._state) - WebInspector.settings.lastDockState.set(this._state); - - if (!docked) { - this._state = WebInspector.DockController.State.Undocked; - WebInspector.userMetrics.WindowDocked.record(); - } else if (this._dockSide === "right") { - this._state = WebInspector.DockController.State.DockedToRight; - WebInspector.userMetrics.WindowUndocked.record(); - } else { - this._state = WebInspector.DockController.State.DockedToBottom; - WebInspector.userMetrics.WindowUndocked.record(); - } - this._updateUI(); - }, - - /** - * @param {boolean} unavailable - */ - setDockingUnavailable: function(unavailable) - { - this._isDockingUnavailable = unavailable; - this._updateUI(); - }, - - _updateUI: function() - { - var body = document.body; - switch (this._state) { - case WebInspector.DockController.State.DockedToBottom: - body.removeStyleClass("undocked"); - body.removeStyleClass("dock-to-right"); - this.setCompactMode(true); - break; - case WebInspector.DockController.State.DockedToRight: - body.removeStyleClass("undocked"); - body.addStyleClass("dock-to-right"); - this.setCompactMode(false); - break; - case WebInspector.DockController.State.Undocked: - body.addStyleClass("undocked"); - body.removeStyleClass("dock-to-right"); - this.setCompactMode(false); - break; - } - - if (this._isDockingUnavailable) { - this._dockToggleButton.state = "undock"; - this._dockToggleButton.disabled = true; - return; - } - - this._dockToggleButton.disabled = false; - - // Choose different last state based on the current one if missing or if is the same. - var states = [WebInspector.DockController.State.DockedToBottom, WebInspector.DockController.State.Undocked, WebInspector.DockController.State.DockedToRight]; - states.remove(this._state); - var lastState = WebInspector.settings.lastDockState.get(); - - states.remove(lastState); - if (states.length === 2) { // last state was not from the list of potential values - lastState = states[0]; - states.remove(lastState); - } - this._decorateButtonForTargetState(this._dockToggleButton, lastState); - this._decorateButtonForTargetState(this._dockToggleButtonOption, states[0]); - }, - - /** - * @param {WebInspector.StatusBarButton} button - * @param {string} state - */ - _decorateButtonForTargetState: function(button, state) - { - switch (state) { - case WebInspector.DockController.State.DockedToBottom: - button.title = WebInspector.UIString("Dock to main window."); - button.state = "bottom"; - break; - case WebInspector.DockController.State.DockedToRight: - button.title = WebInspector.UIString("Dock to main window."); - button.state = "right"; - break; - case WebInspector.DockController.State.Undocked: - button.title = WebInspector.UIString("Undock into separate window."); - button.state = "undock"; - break; - } - }, - - _createDockOptions: function() - { - return [this._dockToggleButtonOption]; - }, - - /** - * @param {WebInspector.Event} e - */ - _toggleDockState: function(e) - { - var state = e.target.state; - switch (state) { - case "undock": - InspectorFrontendHost.requestDetachWindow(); - WebInspector.userMetrics.WindowUndocked.record(); - break; - case "right": - case "bottom": - this._dockSide = state; - InspectorFrontendHost.requestSetDockSide(this._dockSide); - if (this._state === WebInspector.DockController.State.Undocked) - InspectorFrontendHost.requestAttachWindow(); - else - this._innerSetDocked(true); - break; - } - }, - - /** - * @return {boolean} - */ - isCompactMode: function() - { - return this._isCompactMode; - }, - - /** - * @param {boolean} isCompactMode - */ - setCompactMode: function(isCompactMode) - { - var body = document.body; - this._isCompactMode = isCompactMode; - if (WebInspector.toolbar) - WebInspector.toolbar.setCompactMode(isCompactMode); - if (isCompactMode) - body.addStyleClass("compact"); - else - body.removeStyleClass("compact"); - } -} diff --git a/Source/WebCore/inspector/front-end/ElementsPanel.js b/Source/WebCore/inspector/front-end/ElementsPanel.js index b7bb2f6ac..2fa6fc3db 100644 --- a/Source/WebCore/inspector/front-end/ElementsPanel.js +++ b/Source/WebCore/inspector/front-end/ElementsPanel.js @@ -103,8 +103,6 @@ WebInspector.ElementsPanel = function() this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this)); this._popoverHelper.setTimeout(0); - WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._updateBreadcrumbIfNeeded, this); - WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved, this._updateBreadcrumbIfNeeded, this); WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeRemoved, this._nodeRemoved, this); WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdatedEvent, this); WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectElementRequested, this._inspectElementRequested, this); @@ -598,24 +596,6 @@ WebInspector.ElementsPanel.prototype = { this._mouseOutOfCrumbsTimeout = setTimeout(this.updateBreadcrumbSizes.bind(this), 1000); }, - _updateBreadcrumbIfNeeded: function(event) - { - var name = event.data.name; - if (name !== "class" && name !== "id") - return; - - var node = /** @type {WebInspector.DOMNode} */ event.data.node; - var crumbs = this.crumbsElement; - var crumb = crumbs.firstChild; - while (crumb) { - if (crumb.representedObject === node) { - this.updateBreadcrumb(true); - break; - } - crumb = crumb.nextSibling; - } - }, - /** * @param {boolean=} forceUpdate */ @@ -1137,7 +1117,7 @@ WebInspector.ElementsPanel.prototype = { } contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), revealElement.bind(this)); - }, - - __proto__: WebInspector.Panel.prototype + } } + +WebInspector.ElementsPanel.prototype.__proto__ = WebInspector.Panel.prototype; diff --git a/Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js b/Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js index b7ced2af3..d524d15a8 100644 --- a/Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js +++ b/Source/WebCore/inspector/front-end/ElementsPanelDescriptor.js @@ -50,7 +50,7 @@ WebInspector.ElementsPanelDescriptor.prototype = { if (remoteObject.subtype !== "node") return; this.panel().appendApplicableItems(contextMenu, target); - }, - - __proto__: WebInspector.PanelDescriptor.prototype + } } + +WebInspector.ElementsPanelDescriptor.prototype.__proto__ = WebInspector.PanelDescriptor.prototype; diff --git a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js index 20f149e37..07843c96b 100644 --- a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -586,11 +586,11 @@ WebInspector.ElementsTreeOutline.prototype = { newTreeItem.expand(); } return newTreeItem; - }, - - __proto__: TreeOutline.prototype + } } +WebInspector.ElementsTreeOutline.prototype.__proto__ = TreeOutline.prototype; + /** * @interface */ @@ -647,11 +647,11 @@ WebInspector.ElementsTreeOutline.PseudoStateDecorator.prototype = { if (descendantCount === 1) return WebInspector.UIString("%d descendant with forced state", descendantCount); return WebInspector.UIString("%d descendants with forced state", descendantCount); - }, - - __proto__: WebInspector.ElementsTreeOutline.ElementDecorator.prototype + } } +WebInspector.ElementsTreeOutline.PseudoStateDecorator.prototype.__proto__ = WebInspector.ElementsTreeOutline.ElementDecorator.prototype; + /** * @constructor * @extends {TreeElement} @@ -1387,8 +1387,6 @@ WebInspector.ElementsTreeElement.prototype = { event.consume(true); } - initialValue = this._convertWhitespaceToEntities(initialValue); - this._htmlEditElement = document.createElement("div"); this._htmlEditElement.className = "source-code elements-tree-editor"; this._htmlEditElement.textContent = initialValue; @@ -1859,9 +1857,6 @@ WebInspector.ElementsTreeElement.prototype = { if (!firstChild || firstChild.nodeType() !== Node.TEXT_NODE) return null; - if (node.hasShadowRoots()) - return null; - var sibling = firstChild.nextSibling; return sibling ? null : firstChild; }, @@ -1990,11 +1985,11 @@ WebInspector.ElementsTreeElement.prototype = { var node = /** @type {WebInspector.DOMNode} */ this.representedObject; WebInspector.RemoteObject.resolveNode(node, "", scrollIntoViewCallback); - }, - - __proto__: TreeElement.prototype + } } +WebInspector.ElementsTreeElement.prototype.__proto__ = TreeElement.prototype; + /** * @constructor */ diff --git a/Source/WebCore/inspector/front-end/EmptyView.js b/Source/WebCore/inspector/front-end/EmptyView.js index d7a65af27..4b7ceee5e 100644 --- a/Source/WebCore/inspector/front-end/EmptyView.js +++ b/Source/WebCore/inspector/front-end/EmptyView.js @@ -51,7 +51,6 @@ WebInspector.EmptyView.prototype = { if (this.isShowing()) this.element.textContent = this._text; }, - - __proto__: WebInspector.View.prototype } +WebInspector.EmptyView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js b/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js index 294afbbd7..55ebdb084 100644 --- a/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js +++ b/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js @@ -133,11 +133,11 @@ WebInspector.EventListenersSidebarPane.prototype = { var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex]; WebInspector.settings.eventListenersFilter.set(selectedOption.value); this.update(this._selectedNode); - }, - - __proto__: WebInspector.SidebarPane.prototype + } } +WebInspector.EventListenersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + /** * @constructor * @extends {WebInspector.PropertiesSection} @@ -164,11 +164,11 @@ WebInspector.EventListenersSection.prototype = { { var eventListenerBar = new WebInspector.EventListenerBar(eventListener, this._nodeId, this._linkifier); this._eventBars.appendChild(eventListenerBar.element); - }, - - __proto__: WebInspector.PropertiesSection.prototype + } } +WebInspector.EventListenersSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; + /** * @constructor * @extends {WebInspector.ObjectPropertiesSection} @@ -256,7 +256,7 @@ WebInspector.EventListenerBar.prototype = { else this.subtitleElement.textContent = WebInspector.UIString("(anonymous function)"); } - }, - - __proto__: WebInspector.ObjectPropertiesSection.prototype + } } + +WebInspector.EventListenerBar.prototype.__proto__ = WebInspector.ObjectPropertiesSection.prototype; diff --git a/Source/WebCore/inspector/front-end/ExtensionAPI.js b/Source/WebCore/inspector/front-end/ExtensionAPI.js index 583a7171d..a45d83bc3 100644 --- a/Source/WebCore/inspector/front-end/ExtensionAPI.js +++ b/Source/WebCore/inspector/front-end/ExtensionAPI.js @@ -378,11 +378,11 @@ PanelWithSidebarImpl.prototype = { callback(new ExtensionSidebarPane(id)); } extensionServer.sendRequest(request, callback && callbackWrapper); - }, - - __proto__: ExtensionViewImpl.prototype + } } +PanelWithSidebarImpl.prototype.__proto__ = ExtensionViewImpl.prototype; + /** * @constructor * @extends {PanelWithSidebar} @@ -430,10 +430,10 @@ ExtensionPanelImpl.prototype = { id: this._id }; extensionServer.sendRequest(request); - }, + } +}; - __proto__: ExtensionViewImpl.prototype -} +ExtensionPanelImpl.prototype.__proto__ = ExtensionViewImpl.prototype; /** * @constructor @@ -750,9 +750,6 @@ function ExtensionServerClient() } ExtensionServerClient.prototype = { - /** - * @param {function()=} callback - */ sendRequest: function(message, callback) { if (typeof callback === "function") diff --git a/Source/WebCore/inspector/front-end/ExtensionPanel.js b/Source/WebCore/inspector/front-end/ExtensionPanel.js index 043bcc162..f96d9e99e 100644 --- a/Source/WebCore/inspector/front-end/ExtensionPanel.js +++ b/Source/WebCore/inspector/front-end/ExtensionPanel.js @@ -88,11 +88,11 @@ WebInspector.ExtensionPanel.prototype = { { WebInspector.extensionServer.notifySearchAction(this.name, WebInspector.extensionAPI.panels.SearchAction.PreviousSearchResult); WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this); - }, - - __proto__: WebInspector.Panel.prototype + } } +WebInspector.ExtensionPanel.prototype.__proto__ = WebInspector.Panel.prototype; + /** * @constructor * @param {string} id @@ -240,7 +240,7 @@ WebInspector.ExtensionSidebarPane.prototype = { section.editable = false; this._objectPropertiesView.element.appendChild(section.element); callback(); - }, - - __proto__: WebInspector.SidebarPane.prototype + } } + +WebInspector.ExtensionSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/ExtensionView.js b/Source/WebCore/inspector/front-end/ExtensionView.js index 01aecd69c..170db0b6b 100644 --- a/Source/WebCore/inspector/front-end/ExtensionView.js +++ b/Source/WebCore/inspector/front-end/ExtensionView.js @@ -68,11 +68,11 @@ WebInspector.ExtensionView.prototype = { this._frameIndex = Array.prototype.indexOf.call(window.frames, this._iframe.contentWindow); if (this.isShowing()) WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.ExtensionView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.View} @@ -94,7 +94,7 @@ WebInspector.ExtensionNotifierView.prototype = { willHide: function() { WebInspector.extensionServer.notifyViewHidden(this._id); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.ExtensionNotifierView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/FileContentView.js b/Source/WebCore/inspector/front-end/FileContentView.js index b8ccd9ad1..c074128ee 100644 --- a/Source/WebCore/inspector/front-end/FileContentView.js +++ b/Source/WebCore/inspector/front-end/FileContentView.js @@ -85,11 +85,11 @@ WebInspector.FileContentView.prototype = { if (this._file.isTextFile) this._file.requestMetadata(this._metadataReceived.bind(this)); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.FileContentView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @implements {WebInspector.ContentProvider} @@ -104,7 +104,7 @@ WebInspector.FileContentView.FileContentProvider = function(file, metadata) WebInspector.FileContentView.FileContentProvider.prototype = { /** - * @return {string} + * @return {?string} */ contentURL: function() { diff --git a/Source/WebCore/inspector/front-end/FileManager.js b/Source/WebCore/inspector/front-end/FileManager.js index 6b108d3f0..ad101d74a 100644 --- a/Source/WebCore/inspector/front-end/FileManager.js +++ b/Source/WebCore/inspector/front-end/FileManager.js @@ -108,9 +108,9 @@ WebInspector.FileManager.prototype = { appendedToURL: function(url) { this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.AppendedToURL, url); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.FileManager.prototype.__proto__ = WebInspector.Object.prototype; + WebInspector.fileManager = new WebInspector.FileManager(); diff --git a/Source/WebCore/inspector/front-end/FileSystemModel.js b/Source/WebCore/inspector/front-end/FileSystemModel.js index ca5bf7300..81439ce80 100644 --- a/Source/WebCore/inspector/front-end/FileSystemModel.js +++ b/Source/WebCore/inspector/front-end/FileSystemModel.js @@ -412,17 +412,16 @@ WebInspector.FileSystemModel.prototype = { if (Object.isEmpty(this._fileSystemsForOrigin[origin])) delete this._fileSystemsForOrigin[origin]; } - }, - - __proto__: WebInspector.Object.prototype + } } - WebInspector.FileSystemModel.EventTypes = { FileSystemAdded: "FileSystemAdded", FileSystemRemoved: "FileSystemRemoved" } +WebInspector.FileSystemModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {WebInspector.FileSystemModel} fileSystemModel @@ -553,11 +552,11 @@ WebInspector.FileSystemModel.Directory.prototype = { requestDirectoryContent: function(callback) { this.fileSystemModel.requestDirectoryContent(this, callback); - }, - - __proto__: WebInspector.FileSystemModel.Entry.prototype + } } +WebInspector.FileSystemModel.Directory.prototype.__proto__ = WebInspector.FileSystemModel.Entry.prototype; + /** * @constructor * @extends {WebInspector.FileSystemModel.Entry} @@ -609,7 +608,7 @@ WebInspector.FileSystemModel.File.prototype = { requestFileContent: function(readAsText, start, end, charset, callback) { this.fileSystemModel.requestFileContent(this, readAsText, start, end, charset, callback); - }, - - __proto__: WebInspector.FileSystemModel.Entry.prototype + } } + +WebInspector.FileSystemModel.File.prototype.__proto__ = WebInspector.FileSystemModel.Entry.prototype; diff --git a/Source/WebCore/inspector/front-end/FileSystemView.js b/Source/WebCore/inspector/front-end/FileSystemView.js index 174e3450b..60b9f4259 100644 --- a/Source/WebCore/inspector/front-end/FileSystemView.js +++ b/Source/WebCore/inspector/front-end/FileSystemView.js @@ -103,11 +103,11 @@ WebInspector.FileSystemView.prototype = { _delete: function() { this._directoryTree.selectedTreeElement.deleteEntry(); - }, - - __proto__: WebInspector.SplitView.prototype + } } +WebInspector.FileSystemView.prototype.__proto__ = WebInspector.SplitView.prototype; + /** * @constructor * @extends {TreeElement} @@ -227,7 +227,7 @@ WebInspector.FileSystemView.EntryTreeElement.prototype = { { if (this._entry != this._entry.fileSystem.root) this.parent.refresh(); - }, - - __proto__: TreeElement.prototype + } } + +WebInspector.FileSystemView.EntryTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/Source/WebCore/inspector/front-end/FileUtils.js b/Source/WebCore/inspector/front-end/FileUtils.js index 7e95bdfc8..a0bea203e 100644 --- a/Source/WebCore/inspector/front-end/FileUtils.js +++ b/Source/WebCore/inspector/front-end/FileUtils.js @@ -36,19 +36,11 @@ WebInspector.OutputStreamDelegate = function() } WebInspector.OutputStreamDelegate.prototype = { - onTransferStarted: function() { }, + onTransferStarted: function(source) { }, - onTransferFinished: function() { }, + onChunkTransferred: function(source) { }, - /** - * @param {WebInspector.ChunkedReader} reader - */ - onChunkTransferred: function(reader) { }, - - /** - * @param {WebInspector.ChunkedReader} reader - */ - onError: function(reader, event) { }, + onError: function(source, event) { } } /** @@ -69,34 +61,7 @@ WebInspector.OutputStream.prototype = { } /** - * @interface - */ -WebInspector.ChunkedReader = function() -{ -} - -WebInspector.ChunkedReader.prototype = { - /** - * @return {number} - */ - fileSize: function() { }, - - /** - * @return {number} - */ - loadedSize: function() { }, - - /** - * @return {string} - */ - fileName: function() { }, - - cancel: function() { } -} - -/** * @constructor - * @implements {WebInspector.ChunkedReader} * @param {!File} file * @param {number} chunkSize * @param {!WebInspector.OutputStreamDelegate} delegate @@ -122,7 +87,7 @@ WebInspector.ChunkedFileReader.prototype = { this._reader = new FileReader(); this._reader.onload = this._onChunkLoaded.bind(this); this._reader.onerror = this._delegate.onError.bind(this._delegate, this); - this._delegate.onTransferStarted(); + this._delegate.onTransferStarted(this); this._loadChunk(); }, @@ -131,25 +96,16 @@ WebInspector.ChunkedFileReader.prototype = { this._isCanceled = true; }, - /** - * @return {number} - */ loadedSize: function() { return this._loadedSize; }, - /** - * @return {number} - */ fileSize: function() { return this._fileSize; }, - /** - * @return {string} - */ fileName: function() { return this._file.name; @@ -178,7 +134,7 @@ WebInspector.ChunkedFileReader.prototype = { this._file = null; this._reader = null; this._output.close(); - this._delegate.onTransferFinished(); + this._delegate.onTransferFinished(this); return; } @@ -196,7 +152,6 @@ WebInspector.ChunkedFileReader.prototype = { /** * @constructor - * @implements {WebInspector.ChunkedReader} * @param {string} url * @param {!WebInspector.OutputStreamDelegate} delegate */ @@ -224,7 +179,7 @@ WebInspector.ChunkedXHRReader.prototype = { this._xhr.onerror = this._delegate.onError.bind(this._delegate, this); this._xhr.send(null); - this._delegate.onTransferStarted(); + this._delegate.onTransferStarted(this); }, cancel: function() @@ -233,25 +188,16 @@ WebInspector.ChunkedXHRReader.prototype = { this._xhr.abort(); }, - /** - * @return {number} - */ loadedSize: function() { return this._loadedSize; }, - /** - * @return {number} - */ fileSize: function() { return this._fileSize; }, - /** - * @return {string} - */ fileName: function() { return this._url; @@ -290,7 +236,7 @@ WebInspector.ChunkedXHRReader.prototype = { return; this._output.close(); - this._delegate.onTransferFinished(); + this._delegate.onTransferFinished(this); } } diff --git a/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js b/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js index 6d6cb4b58..41340a894 100644 --- a/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js +++ b/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js @@ -202,7 +202,7 @@ WebInspector.FilteredItemSelectionDialog.prototype = { regExpString = regExpString.replace(/(?!^)(\\\.|[_:-])/g, "[^._:-]*$1"); else regExpString = regExpString.replace(/(?!^)(\\\.|[A-Z_:-])/g, "[^.A-Z_:-]*$1"); - regExpString = regExpString; + regExpString = "^" + "[^a-zA-Z0-9]*" + regExpString; return new RegExp(regExpString, (ignoreCase ? "i" : "") + (isGlobal ? "g" : "")); }, @@ -409,11 +409,11 @@ WebInspector.FilteredItemSelectionDialog.prototype = { if (itemElement.offsetTop > this._itemElementsContainer.scrollTop + this._itemHeight * (this._rowsPerViewport + 1)) return false; return true; - }, - - __proto__: WebInspector.DialogDelegate.prototype + } } +WebInspector.FilteredItemSelectionDialog.prototype.__proto__ = WebInspector.DialogDelegate.prototype; + /** * @interface */ @@ -600,11 +600,11 @@ WebInspector.JavaScriptOutlineDialog.prototype = { rewriteQuery: function(query) { return query; - }, - - __proto__: WebInspector.SelectionDialogContentProvider.prototype + } } +WebInspector.JavaScriptOutlineDialog.prototype.__proto__ = WebInspector.SelectionDialogContentProvider.prototype; + /** * @constructor * @implements {WebInspector.SelectionDialogContentProvider} @@ -707,11 +707,11 @@ WebInspector.OpenResourceDialog.prototype = { var lineNumberMatch = query.match(/([^:]+)(\:[\d]*)$/); this._queryLineNumber = lineNumberMatch ? lineNumberMatch[2] : ""; return lineNumberMatch ? lineNumberMatch[1] : query; - }, - - __proto__: WebInspector.SelectionDialogContentProvider.prototype + } } +WebInspector.OpenResourceDialog.prototype.__proto__ = WebInspector.SelectionDialogContentProvider.prototype; + /** * @param {WebInspector.ScriptsPanel} panel * @param {WebInspector.UISourceCodeProvider} uiSourceCodeProvider diff --git a/Source/WebCore/inspector/front-end/FontView.js b/Source/WebCore/inspector/front-end/FontView.js index 64dbd5b6b..a09c37221 100644 --- a/Source/WebCore/inspector/front-end/FontView.js +++ b/Source/WebCore/inspector/front-end/FontView.js @@ -135,7 +135,7 @@ WebInspector.FontView.prototype = { var finalFontSize = Math.floor(WebInspector.FontView._measureFontSize * Math.min(widthRatio, heightRatio)) - 2; this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "px", null); - }, - - __proto__: WebInspector.ResourceView.prototype + } } + +WebInspector.FontView.prototype.__proto__ = WebInspector.ResourceView.prototype; diff --git a/Source/WebCore/inspector/front-end/GoToLineDialog.js b/Source/WebCore/inspector/front-end/GoToLineDialog.js index ac41b7ad9..a44dc3ef3 100644 --- a/Source/WebCore/inspector/front-end/GoToLineDialog.js +++ b/Source/WebCore/inspector/front-end/GoToLineDialog.js @@ -108,7 +108,7 @@ WebInspector.GoToLineDialog.prototype = { onEnter: function() { this._applyLineNumber(); - }, - - __proto__: WebInspector.DialogDelegate.prototype + } } + +WebInspector.GoToLineDialog.prototype.__proto__ = WebInspector.DialogDelegate.prototype; diff --git a/Source/WebCore/inspector/front-end/HandlerRegistry.js b/Source/WebCore/inspector/front-end/HandlerRegistry.js index 5c8cc74d2..ef47a7694 100644 --- a/Source/WebCore/inspector/front-end/HandlerRegistry.js +++ b/Source/WebCore/inspector/front-end/HandlerRegistry.js @@ -175,16 +175,15 @@ WebInspector.HandlerRegistry.prototype = { if (WebInspector.resourceForURL(resourceURL)) contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open link in Resources panel" : "Open Link in Resources Panel"), WebInspector.openResource.bind(null, resourceURL, true)); contextMenu.appendItem(WebInspector.copyLinkAddressLabel(), InspectorFrontendHost.copyText.bind(InspectorFrontendHost, resourceURL)); - }, - - __proto__: WebInspector.Object.prototype + } } - WebInspector.HandlerRegistry.EventTypes = { HandlersUpdated: "HandlersUpdated" } +WebInspector.HandlerRegistry.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor */ diff --git a/Source/WebCore/inspector/front-end/HeapSnapshot.js b/Source/WebCore/inspector/front-end/HeapSnapshot.js index a44d7f6f4..169654056 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshot.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshot.js @@ -1904,11 +1904,10 @@ WebInspector.HeapSnapshotEdgesProvider.prototype = { this._iterationOrder.sortRange(compareNodeAndEdge, leftBound, rightBound, count); else this._iterationOrder.sortRange(compareNodeAndNode, leftBound, rightBound, count); - }, - - __proto__: WebInspector.HeapSnapshotFilteredOrderedIterator.prototype -} + } +}; +WebInspector.HeapSnapshotEdgesProvider.prototype.__proto__ = WebInspector.HeapSnapshotFilteredOrderedIterator.prototype; /** * @constructor @@ -1982,8 +1981,7 @@ WebInspector.HeapSnapshotNodesProvider.prototype = { } this._iterationOrder.sortRange(sortByComparator, leftBound, rightBound, count); - }, - - __proto__: WebInspector.HeapSnapshotFilteredOrderedIterator.prototype -} + } +}; +WebInspector.HeapSnapshotNodesProvider.prototype.__proto__ = WebInspector.HeapSnapshotFilteredOrderedIterator.prototype; diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js b/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js index 1ca3fbb27..3a22b8bac 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js @@ -252,11 +252,10 @@ WebInspector.HeapSnapshotSortableDataGrid.prototype = { return; if (!--this._recursiveSortingDepth) this.dispatchEventToListeners("sorting complete"); - }, - - __proto__: WebInspector.DataGrid.prototype -} + } +}; +WebInspector.HeapSnapshotSortableDataGrid.prototype.__proto__ = WebInspector.DataGrid.prototype; /** @@ -394,11 +393,11 @@ WebInspector.HeapSnapshotViewportDataGrid.prototype = { WebInspector.HeapSnapshotSortableDataGrid.prototype.highlightNode.call(this, this._nodeToHighlightAfterScroll); this._nodeToHighlightAfterScroll = null; } - }, - - __proto__: WebInspector.HeapSnapshotSortableDataGrid.prototype + } } +WebInspector.HeapSnapshotViewportDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype; + /** * @constructor */ @@ -451,11 +450,10 @@ WebInspector.HeapSnapshotContainmentDataGrid.prototype = { sortingChanged: function() { this.rootNode().sort(); - }, - - __proto__: WebInspector.HeapSnapshotSortableDataGrid.prototype -} + } +}; +WebInspector.HeapSnapshotContainmentDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype; /** * @constructor @@ -490,10 +488,9 @@ WebInspector.HeapSnapshotRetainmentDataGrid.prototype = { this.rootNode().removeChildren(); this.resetSortingCache(); }, - - __proto__: WebInspector.HeapSnapshotContainmentDataGrid.prototype } +WebInspector.HeapSnapshotRetainmentDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotContainmentDataGrid.prototype; /** * @constructor @@ -600,9 +597,9 @@ WebInspector.HeapSnapshotConstructorsDataGrid.prototype = { this._populateChildren(); }, - __proto__: WebInspector.HeapSnapshotViewportDataGrid.prototype -} +}; +WebInspector.HeapSnapshotConstructorsDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotViewportDataGrid.prototype; /** * @constructor @@ -685,11 +682,10 @@ WebInspector.HeapSnapshotDiffDataGrid.prototype = { // we first need to collect information about the nodes in the first snapshot and // then pass it to the second snapshot to calclulate the diff. this.baseSnapshot.aggregatesForDiff(aggregatesForDiffReceived.bind(this)); - }, - - __proto__: WebInspector.HeapSnapshotViewportDataGrid.prototype -} + } +}; +WebInspector.HeapSnapshotDiffDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotViewportDataGrid.prototype; /** * @constructor @@ -773,8 +769,7 @@ WebInspector.HeapSnapshotDominatorsDataGrid.prototype = { } this.snapshot.dominatorIdsForNode(parseInt(id, 10), didGetDominators.bind(this)); - }, - - __proto__: WebInspector.HeapSnapshotSortableDataGrid.prototype -} + } +}; +WebInspector.HeapSnapshotDominatorsDataGrid.prototype.__proto__ = WebInspector.HeapSnapshotSortableDataGrid.prototype; diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js b/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js index 40e815400..88564f1f8 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotGridNodes.js @@ -331,11 +331,10 @@ WebInspector.HeapSnapshotGridNode.prototype = { } this._provider().sortAndRewind(this.comparator(), afterSort.bind(this)); - }, - - __proto__: WebInspector.DataGridNode.prototype -} + } +}; +WebInspector.HeapSnapshotGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; /** * @constructor @@ -506,11 +505,11 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = { return fullName.substr(0, startPos + 2) + url + fullName.substr(endPos); } else return fullName; - }, - - __proto__: WebInspector.HeapSnapshotGridNode.prototype + } } +WebInspector.HeapSnapshotGenericObjectNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype; + /** * @constructor * @extends {WebInspector.HeapSnapshotGenericObjectNode} @@ -637,11 +636,11 @@ WebInspector.HeapSnapshotObjectNode.prototype = { separatorSpan.className = "grayed"; separatorSpan.textContent = this.showRetainingEdges ? " in " : " :: "; div.appendChild(separatorSpan); - }, - - __proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype + } } +WebInspector.HeapSnapshotObjectNode.prototype.__proto__ = WebInspector.HeapSnapshotGenericObjectNode.prototype; + /** * @constructor * @extends {WebInspector.HeapSnapshotGenericObjectNode} @@ -721,11 +720,11 @@ WebInspector.HeapSnapshotInstanceNode.prototype = { get isDeletedNode() { return this._isDeletedNode; - }, - - __proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype + } } +WebInspector.HeapSnapshotInstanceNode.prototype.__proto__ = WebInspector.HeapSnapshotGenericObjectNode.prototype; + /** * @constructor * @extends {WebInspector.HeapSnapshotGridNode} @@ -851,11 +850,10 @@ WebInspector.HeapSnapshotConstructorNode.prototype = { get _shallowSizePercent() { return this._shallowSize / this.dataGrid.snapshot.totalSize * 100.0; - }, - - __proto__: WebInspector.HeapSnapshotGridNode.prototype -} + } +}; +WebInspector.HeapSnapshotConstructorNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype; /** * @constructor @@ -1019,11 +1017,10 @@ WebInspector.HeapSnapshotDiffNode.prototype = { data["sizeDelta"] = this._signForDelta(this._sizeDelta) + Number.withThousandsSeparator(Math.abs(this._sizeDelta)); return data; - }, - - __proto__: WebInspector.HeapSnapshotGridNode.prototype -} + } +}; +WebInspector.HeapSnapshotDiffNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype; /** * @constructor @@ -1107,8 +1104,7 @@ WebInspector.HeapSnapshotDominatorObjectNode.prototype = { _emptyData: function() { return {}; - }, - - __proto__: WebInspector.HeapSnapshotGenericObjectNode.prototype -} + } +}; +WebInspector.HeapSnapshotDominatorObjectNode.prototype.__proto__ = WebInspector.HeapSnapshotGenericObjectNode.prototype; diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js b/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js index 9ebeb8f76..1b24ba20f 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js @@ -42,11 +42,11 @@ WebInspector.HeapSnapshotWorkerWrapper.prototype = { }, terminate: function() { - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.HeapSnapshotWorkerWrapper.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @extends {WebInspector.HeapSnapshotWorkerWrapper} @@ -84,11 +84,10 @@ WebInspector.HeapSnapshotRealWorker.prototype = { terminate: function() { this._worker.terminate(); - }, - - __proto__: WebInspector.HeapSnapshotWorkerWrapper.prototype -} + } +}; +WebInspector.HeapSnapshotRealWorker.prototype.__proto__ = WebInspector.HeapSnapshotWorkerWrapper.prototype; /** * @constructor @@ -166,11 +165,10 @@ WebInspector.HeapSnapshotFakeWorker.prototype = { this.dispatchEventToListeners("message", message); } this._asyncTaskQueue.addTask(send.bind(this)); - }, - - __proto__: WebInspector.HeapSnapshotWorkerWrapper.prototype -} + } +}; +WebInspector.HeapSnapshotFakeWorker.prototype.__proto__ = WebInspector.HeapSnapshotWorkerWrapper.prototype; /** * @constructor @@ -297,11 +295,10 @@ WebInspector.HeapSnapshotWorker.prototype = { _postMessage: function(message) { this._worker.postMessage(message); - }, - - __proto__: WebInspector.Object.prototype -} + } +}; +WebInspector.HeapSnapshotWorker.prototype.__proto__ = WebInspector.Object.prototype; /** * @constructor @@ -363,10 +360,21 @@ WebInspector.HeapSnapshotProxyObject.prototype = { WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId) { WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId); + this._started = false; this._pendingSnapshotConsumers = []; } WebInspector.HeapSnapshotLoaderProxy.prototype = { + startTransfer: function() + { + this._started = true; + }, + + isStarted: function() + { + return this._started; + }, + /** * @param {function(WebInspector.HeapSnapshotProxy)} callback */ @@ -377,11 +385,10 @@ WebInspector.HeapSnapshotLoaderProxy.prototype = { /** * @param {string} chunk - * @param {function(WebInspector.OutputStream)=} callback */ - write: function(chunk, callback) + write: function(chunk) { - this.callMethod(callback, "write", chunk); + this.callMethod(null, "write", chunk); }, close: function() @@ -399,14 +406,15 @@ WebInspector.HeapSnapshotLoaderProxy.prototype = { { for (var i = 0; i < this._pendingSnapshotConsumers.length; ++i) this._pendingSnapshotConsumers[i](snapshotProxy); + + this._started = false; this._pendingSnapshotConsumers = []; } this.callMethod(buildSnapshot.bind(this), "close"); - }, - - __proto__: WebInspector.HeapSnapshotProxyObject.prototype -} + } +}; +WebInspector.HeapSnapshotLoaderProxy.prototype.__proto__ = WebInspector.HeapSnapshotProxyObject.prototype; /** * @constructor @@ -516,11 +524,10 @@ WebInspector.HeapSnapshotProxy.prototype = { get uid() { return this._staticData.uid; - }, - - __proto__: WebInspector.HeapSnapshotProxyObject.prototype -} + } +}; +WebInspector.HeapSnapshotProxy.prototype.__proto__ = WebInspector.HeapSnapshotProxyObject.prototype; /** * @constructor @@ -550,8 +557,7 @@ WebInspector.HeapSnapshotProviderProxy.prototype = { sortAndRewind: function(comparator, callback) { this.callMethod(callback, "sortAndRewind", comparator); - }, - - __proto__: WebInspector.HeapSnapshotProxyObject.prototype -} + } +}; +WebInspector.HeapSnapshotProviderProxy.prototype.__proto__ = WebInspector.HeapSnapshotProxyObject.prototype; diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotView.js b/Source/WebCore/inspector/front-end/HeapSnapshotView.js index a094b458a..35ed79677 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotView.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotView.js @@ -732,11 +732,10 @@ WebInspector.HeapSnapshotView.prototype = { filterOption.label = title; this.filterSelectElement.appendChild(filterOption); } - }, - - __proto__: WebInspector.View.prototype -} + } +}; +WebInspector.HeapSnapshotView.prototype.__proto__ = WebInspector.View.prototype; /** * @constructor @@ -795,11 +794,11 @@ WebInspector.HeapSnapshotProfileType.prototype = { createProfile: function(profile) { return new WebInspector.HeapProfileHeader(this, profile.title, profile.uid, profile.maxJSObjectId || 0); - }, - - __proto__: WebInspector.ProfileType.prototype + } } +WebInspector.HeapSnapshotProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype; + /** * @constructor * @extends {WebInspector.ProfileHeader} @@ -813,7 +812,7 @@ WebInspector.HeapProfileHeader = function(type, title, uid, maxJSObjectId) WebInspector.ProfileHeader.call(this, type, title, uid); this.maxJSObjectId = maxJSObjectId; /** - * @type {WebInspector.OutputStream} + * @type {WebInspector.FileOutputStream} */ this._receiver = null; /** @@ -858,8 +857,6 @@ WebInspector.HeapProfileHeader.prototype = { } this._numberOfChunks = 0; - this._savedChunks = 0; - this._savingToFile = false; if (!this._receiver) { this._setupWorker(); this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026"); @@ -892,22 +889,15 @@ WebInspector.HeapProfileHeader.prototype = { }, /** - * @param {number} value - * @param {number} maxValue + * @param {number} savedChunksCount */ - _updateTransferProgress: function(value, maxValue) + _saveStatusUpdate: function(savedChunksCount) { - var percentValue = ((maxValue ? (value / maxValue) : 0) * 100).toFixed(2); - if (this._savingToFile) - this.sidebarElement.subtitle = WebInspector.UIString("Saving\u2026 %d\%", percentValue); - else - this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026 %d\%", percentValue); - }, - - _updateSnapshotStatus: function() - { - this.sidebarElement.subtitle = Number.bytesToString(this._snapshotProxy.totalSize); - this.sidebarElement.wait = false; + if (savedChunksCount === this._totalNumberOfChunks) { + this.sidebarElement.subtitle = Number.bytesToString(this._snapshotProxy.totalSize); + this.sidebarElement.wait = false; + } else + this.sidebarElement.subtitle = WebInspector.UIString("Saving\u2026 %d\%", (savedChunksCount * 100 / this._totalNumberOfChunks).toFixed(2)); }, /** @@ -919,32 +909,31 @@ WebInspector.HeapProfileHeader.prototype = { this._receiver.write(chunk, callback.bind(this)); function callback() { - this._updateTransferProgress(++this._savedChunks, this._totalNumberOfChunks); - if (this._totalNumberOfChunks === this._savedChunks) { - if (this._savingToFile) - this._updateSnapshotStatus(); - else - this.sidebarElement.subtitle = WebInspector.UIString("Parsing\u2026"); - - this._receiver.close(); - } + this._saveStatusUpdate(++this._savedChunks); + if (this._totalNumberOfChunks === this._savedChunks) + this._snapshotReceived(null); } }, _snapshotReceived: function(snapshotProxy) { + this._receiver.close(); this._receiver = null; if (snapshotProxy) this._snapshotProxy = snapshotProxy; - this._updateSnapshotStatus(); + this.sidebarElement.subtitle = Number.bytesToString(this._snapshotProxy.totalSize); + this.sidebarElement.wait = false; var worker = /** @type {WebInspector.HeapSnapshotWorker} */ this._snapshotProxy.worker; this.isTemporary = false; worker.startCheckingForLongRunningCalls(); }, - finishHeapSnapshot: function() + finishHeapSnapshot: function(transferFinished) { this._totalNumberOfChunks = this._numberOfChunks; + this.sidebarElement.subtitle = WebInspector.UIString("Parsing\u2026"); + if (!transferFinished && this._receiver) + this._receiver.close(); }, /** @@ -965,10 +954,9 @@ WebInspector.HeapProfileHeader.prototype = { function onOpen() { this._savedChunks = 0; - this._updateTransferProgress(0, this._totalNumberOfChunks); + this._saveStatusUpdate(0); ProfilerAgent.getProfile(this.profileType().id, this.uid); } - this._savingToFile = true; this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact() + ".heapsnapshot"; this._receiver = new WebInspector.FileOutputStream(); this._receiver.open(this._fileName, onOpen.bind(this)); @@ -993,7 +981,6 @@ WebInspector.HeapProfileHeader.prototype = { this.sidebarElement.wait = true; this._setupWorker(); this._numberOfChunks = 0; - this._savingToFile = false; var delegate = new WebInspector.HeapSnapshotLoadFromFileDelegate(this); var fileReader = this._createFileReader(file, delegate); @@ -1003,11 +990,11 @@ WebInspector.HeapProfileHeader.prototype = { _createFileReader: function(file, delegate) { return new WebInspector.ChunkedFileReader(file, 10000000, delegate); - }, - - __proto__: WebInspector.ProfileHeader.prototype + } } +WebInspector.HeapProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype; + /** * @constructor * @implements {WebInspector.OutputStreamDelegate} @@ -1018,39 +1005,34 @@ WebInspector.HeapSnapshotLoadFromFileDelegate = function(snapshotHeader) } WebInspector.HeapSnapshotLoadFromFileDelegate.prototype = { - onTransferStarted: function() + onTransferStarted: function(source) { }, - /** - * @param {WebInspector.ChunkedReader} reader - */ - onChunkTransferred: function(reader) + onChunkTransferred: function(source) { - this._snapshotHeader._updateTransferProgress(reader.loadedSize(), reader.fileSize()); + this._snapshotHeader.sidebarElement.subtitle = WebInspector.UIString( + "Loading\u2026 %d%", (source.loadedSize() * 100 / source.fileSize()).toFixed(2)); }, - onTransferFinished: function() + onTransferFinished: function(source) { - this._snapshotHeader.finishHeapSnapshot(); + this._snapshotHeader.finishHeapSnapshot(true); }, - /** - * @param {WebInspector.ChunkedReader} reader - */ - onError: function (reader, e) + onError: function (source, e) { switch(e.target.error.code) { case e.target.error.NOT_FOUND_ERR: - this._snapshotHeader.sidebarElement.subtitle = WebInspector.UIString("'%s' not found.", reader.fileName()); + this._snapshotHeader.sidebarElement.subtitle = WebInspector.UIString("'%s' not found.", source.fileName()); break; case e.target.error.NOT_READABLE_ERR: - this._snapshotHeader.sidebarElement.subtitle = WebInspector.UIString("'%s' is not readable", reader.fileName()); + this._snapshotHeader.sidebarElement.subtitle = WebInspector.UIString("'%s' is not readable", source.fileName()); break; case e.target.error.ABORT_ERR: break; default: - this._snapshotHeader.sidebarElement.subtitle = WebInspector.UIString("'%s' error %d", reader.fileName(), e.target.error.code); + this._snapshotHeader.sidebarElement.subtitle = WebInspector.UIString("'%s' error %d", source.fileName(), e.target.error.code); } } } diff --git a/Source/WebCore/inspector/front-end/HelpScreen.js b/Source/WebCore/inspector/front-end/HelpScreen.js index 48525e665..0855a1269 100644 --- a/Source/WebCore/inspector/front-end/HelpScreen.js +++ b/Source/WebCore/inspector/front-end/HelpScreen.js @@ -118,7 +118,7 @@ WebInspector.HelpScreen.prototype = { // Pretend we're modal, grab focus back if we're still shown. if (this.isShowing() && !this.element.isSelfOrAncestor(event.target)) WebInspector.setCurrentFocusElement(this.element); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.HelpScreen.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/ImageView.js b/Source/WebCore/inspector/front-end/ImageView.js index d2c79b30b..7b5cf13e0 100644 --- a/Source/WebCore/inspector/front-end/ImageView.js +++ b/Source/WebCore/inspector/front-end/ImageView.js @@ -140,7 +140,7 @@ WebInspector.ImageView.prototype = { _openInNewTab: function(event) { InspectorFrontendHost.openInNewTab(this.resource.url); - }, - - __proto__: WebInspector.ResourceView.prototype + } } + +WebInspector.ImageView.prototype.__proto__ = WebInspector.ResourceView.prototype; diff --git a/Source/WebCore/inspector/front-end/IndexedDBModel.js b/Source/WebCore/inspector/front-end/IndexedDBModel.js index 0c4fed07e..6f9fa4200 100644 --- a/Source/WebCore/inspector/front-end/IndexedDBModel.js +++ b/Source/WebCore/inspector/front-end/IndexedDBModel.js @@ -392,7 +392,7 @@ WebInspector.IndexedDBModel.prototype = { if (!this._frames[frameId]) return; - var databaseModel = new WebInspector.IndexedDBModel.Database(databaseId, databaseWithObjectStores.version, databaseWithObjectStores.intVersion); + var databaseModel = new WebInspector.IndexedDBModel.Database(databaseId, databaseWithObjectStores.version); this._databases.put(databaseId, databaseModel); for (var i = 0; i < databaseWithObjectStores.objectStores.length; ++i) { var objectStore = databaseWithObjectStores.objectStores[i]; @@ -483,11 +483,11 @@ WebInspector.IndexedDBModel.prototype = { var keyRange = WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange); IndexedDBAgent.requestData(frameId, databaseName, objectStoreName, indexName, skipCount, pageSize, keyRange ? keyRange : undefined, innerCallback.bind(this)); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.IndexedDBModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {*} key @@ -538,11 +538,10 @@ WebInspector.IndexedDBModel.DatabaseId.prototype = { * @param {WebInspector.IndexedDBModel.DatabaseId} databaseId * @param {string} version */ -WebInspector.IndexedDBModel.Database = function(databaseId, version, intVersion) +WebInspector.IndexedDBModel.Database = function(databaseId, version) { this.databaseId = databaseId; this.version = version; - this.intVersion = intVersion; this.objectStores = {}; } diff --git a/Source/WebCore/inspector/front-end/IndexedDBViews.js b/Source/WebCore/inspector/front-end/IndexedDBViews.js index d30006a78..fad4e5577 100644 --- a/Source/WebCore/inspector/front-end/IndexedDBViews.js +++ b/Source/WebCore/inspector/front-end/IndexedDBViews.js @@ -53,13 +53,9 @@ WebInspector.IDBDatabaseView = function(database) this._nameTreeElement.selectable = false; this._headersTreeOutline.appendChild(this._nameTreeElement); - this._intVersionTreeElement = new TreeElement("", null, false); - this._intVersionTreeElement.selectable = false; - this._headersTreeOutline.appendChild(this._intVersionTreeElement); - - this._stringVersionTreeElement = new TreeElement("", null, false); - this._stringVersionTreeElement.selectable = false; - this._headersTreeOutline.appendChild(this._stringVersionTreeElement); + this._versionTreeElement = new TreeElement("", null, false); + this._versionTreeElement.selectable = false; + this._headersTreeOutline.appendChild(this._versionTreeElement); this.update(database); } @@ -82,8 +78,7 @@ WebInspector.IDBDatabaseView.prototype = { { this._securityOriginTreeElement.title = this._formatHeader(WebInspector.UIString("Security origin"), this._database.databaseId.securityOrigin); this._nameTreeElement.title = this._formatHeader(WebInspector.UIString("Name"), this._database.databaseId.name); - this._stringVersionTreeElement.title = this._formatHeader(WebInspector.UIString("String Version"), this._database.version); - this._intVersionTreeElement.title = this._formatHeader(WebInspector.UIString("Integer Version"), this._database.intVersion); + this._versionTreeElement.title = this._formatHeader(WebInspector.UIString("Version"), this._database.version); }, /** @@ -94,10 +89,9 @@ WebInspector.IDBDatabaseView.prototype = { this._database = database; this._refreshDatabase(); }, - - __proto__: WebInspector.View.prototype } +WebInspector.IDBDatabaseView.prototype.__proto__ = WebInspector.View.prototype; /** * @constructor @@ -368,11 +362,11 @@ WebInspector.IDBDataView.prototype = { value.release(); } this._entries = []; - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.IDBDataView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.DataGridNode} @@ -433,8 +427,7 @@ WebInspector.IDBDataGridNode.prototype = { contents.addStyleClass("primitive-value"); contents.appendChild(document.createTextNode(value.description)); } - }, - - __proto__: WebInspector.DataGridNode.prototype -} + } +}; +WebInspector.IDBDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; diff --git a/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js b/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js index 70b7cfdd7..06363986e 100644 --- a/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js +++ b/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js @@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -var InspectorFrontendAPI = { +InspectorFrontendAPI = { _pendingCommands: [], isDebuggingEnabled: function() @@ -76,8 +76,7 @@ var InspectorFrontendAPI = { setAttachedWindow: function(attached) { - if (WebInspector.dockController) - WebInspector.dockController.setDocked(attached); + WebInspector.attached = attached; }, showConsole: function() diff --git a/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js index d706b5977..dc2701cd0 100644 --- a/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js +++ b/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js @@ -70,12 +70,10 @@ WebInspector.InspectorFrontendHostStub.prototype = { requestAttachWindow: function() { - InspectorFrontendAPI.setAttachedWindow(true); }, requestDetachWindow: function() { - InspectorFrontendAPI.setAttachedWindow(false); }, requestSetDockSide: function() @@ -143,7 +141,9 @@ WebInspector.InspectorFrontendHostStub.prototype = { save: function(url, content, forceSaveAs) { - var blob = new Blob([content], { type: "application/octet-stream" }); + var builder = new WebKitBlobBuilder(); + builder.append(content); + var blob = builder.getBlob("application/octet-stream"); var fr = new FileReader(); fr.onload = function(e) { @@ -217,8 +217,6 @@ WebInspector.ClipboardAccessDeniedScreen = function() } } -WebInspector.ClipboardAccessDeniedScreen.prototype = { - __proto__: WebInspector.HelpScreen.prototype -} +WebInspector.ClipboardAccessDeniedScreen.prototype.__proto__ = WebInspector.HelpScreen.prototype; } diff --git a/Source/WebCore/inspector/front-end/InspectorView.js b/Source/WebCore/inspector/front-end/InspectorView.js index 229b2df2f..b521a9d1d 100644 --- a/Source/WebCore/inspector/front-end/InspectorView.js +++ b/Source/WebCore/inspector/front-end/InspectorView.js @@ -132,23 +132,10 @@ WebInspector.InspectorView.prototype = { _keyDown: function(event) { - if (!WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) - return; - - // Ctrl/Cmd + 1-9 should show corresponding panel. - if (!event.shiftKey && !event.altKey && event.keyCode > 0x30 && event.keyCode < 0x3A) { - var panelName = this._panelOrder[event.keyCode - 0x31]; - if (panelName) { - this.showPanel(panelName); - event.consume(true); - } - return; - } - // BUG85312: On French AZERTY keyboards, AltGr-]/[ combinations (synonymous to Ctrl-Alt-]/[ on Windows) are used to enter ]/[, // so for a ]/[-related keydown we delay the panel switch using a timer, to see if there is a keypress event following this one. // If there is, we cancel the timer and do not consider this a panel switch. - if (!WebInspector.isWin() || (!this._openBracketIdentifiers[event.keyIdentifier] && !this._closeBracketIdentifiers[event.keyIdentifier])) { + if (!WebInspector.isWin() || (!this._openBracketIdentifiers.hasOwnProperty(event.keyIdentifier) && !this._closeBracketIdentifiers.hasOwnProperty(event.keyIdentifier))) { this._keyDownInternal(event); return; } @@ -158,8 +145,8 @@ WebInspector.InspectorView.prototype = { _keyDownInternal: function(event) { - if (this._openBracketIdentifiers[event.keyIdentifier]) { - var isRotateLeft = !event.shiftKey && !event.altKey; + if (this._openBracketIdentifiers.hasOwnProperty(event.keyIdentifier)) { + var isRotateLeft = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && !event.altKey; if (isRotateLeft) { var index = this._panelOrder.indexOf(this.currentPanel().name); index = (index === 0) ? this._panelOrder.length - 1 : index - 1; @@ -168,7 +155,7 @@ WebInspector.InspectorView.prototype = { return; } - var isGoBack = event.altKey; + var isGoBack = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && event.altKey; if (isGoBack && this._canGoBackInHistory()) { this._goBackInHistory(); event.consume(true); @@ -176,8 +163,8 @@ WebInspector.InspectorView.prototype = { return; } - if (this._closeBracketIdentifiers[event.keyIdentifier]) { - var isRotateRight = !event.shiftKey && !event.altKey; + if (this._closeBracketIdentifiers.hasOwnProperty(event.keyIdentifier)) { + var isRotateRight = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && !event.altKey; if (isRotateRight) { var index = this._panelOrder.indexOf(this.currentPanel().name); index = (index + 1) % this._panelOrder.length; @@ -186,7 +173,7 @@ WebInspector.InspectorView.prototype = { return; } - var isGoForward = event.altKey; + var isGoForward = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && event.altKey; if (isGoForward && this._canGoForwardInHistory()) { this._goForwardInHistory(); event.consume(true); @@ -259,11 +246,11 @@ WebInspector.InspectorView.prototype = { { WebInspector.searchController.disableSearchUntilExplicitAction(); this.setCurrentPanel(panel); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.InspectorView.prototype.__proto__ = WebInspector.View.prototype; + /** * @type {WebInspector.InspectorView} */ diff --git a/Source/WebCore/inspector/front-end/JavaScriptSource.js b/Source/WebCore/inspector/front-end/JavaScriptSource.js index 35f918e0e..a641c2d18 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSource.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSource.js @@ -32,14 +32,97 @@ * @constructor * @extends {WebInspector.UISourceCode} * @param {string} url + * @param {WebInspector.Resource} resource * @param {WebInspector.ContentProvider} contentProvider - * @param {boolean} isEditable */ -WebInspector.JavaScriptSource = function(url, contentProvider, isEditable) +WebInspector.JavaScriptSource = function(url, resource, contentProvider, isEditable) { - WebInspector.UISourceCode.call(this, url, contentProvider, isEditable); + WebInspector.UISourceCode.call(this, url, resource, contentProvider); + this._isEditable = isEditable; } WebInspector.JavaScriptSource.prototype = { - __proto__: WebInspector.UISourceCode.prototype + /** + * @param {number} lineNumber + * @param {number} columnNumber + * @return {WebInspector.DebuggerModel.Location} + */ + uiLocationToRawLocation: function(lineNumber, columnNumber) + { + var rawLocation = WebInspector.UISourceCode.prototype.uiLocationToRawLocation.call(this, lineNumber, columnNumber); + var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Location} */ rawLocation; + return debuggerModelLocation; + }, + + /** + * @return {boolean} + */ + supportsEnabledBreakpointsWhileEditing: function() + { + return false; + }, + + /** + * @return {string} + */ + breakpointStorageId: function() + { + return this.formatted() ? "deobfuscated:" + this.url : this.url; + }, + + /** + * @return {boolean} + */ + isEditable: function() + { + return this._isEditable && WebInspector.debuggerModel.canSetScriptSource(); + }, + + /** + * @return {boolean} + */ + isDivergedFromVM: function() + { + // FIXME: We should return true if this._isDivergedFromVM is set as well once we provide a way to set breakpoints after LiveEdit failure. + return this.isDirty(); + }, + + /** + * @param {function(?string)} callback + */ + workingCopyCommitted: function(callback) + { + /** + * @param {?string} error + */ + function innerCallback(error) + { + this._isDivergedFromVM = !!error; + callback(error); + } + + var rawLocation = this.uiLocationToRawLocation(0, 0); + var script = WebInspector.debuggerModel.scriptForId(rawLocation.scriptId); + WebInspector.debuggerModel.setScriptSource(script.scriptId, this.workingCopy(), innerCallback.bind(this)); + }, + + /** + * @param {string} query + * @param {boolean} caseSensitive + * @param {boolean} isRegex + * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback + */ + searchInContent: function(query, caseSensitive, isRegex, callback) + { + var content = this.content(); + var provider = content ? new WebInspector.StaticContentProvider(this._contentProvider.contentType(), content) : this._contentProvider; + provider.searchInContent(query, caseSensitive, isRegex, callback); + }, + + formattedChanged: function() + { + WebInspector.breakpointManager.restoreBreakpoints(this); + } } + +WebInspector.JavaScriptSource.prototype.__proto__ = WebInspector.UISourceCode.prototype; diff --git a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js index 3edeff8a5..fdd730ad3 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js @@ -39,7 +39,6 @@ WebInspector.JavaScriptSourceFrame = function(scriptsPanel, javaScriptSource) this._scriptsPanel = scriptsPanel; this._breakpointManager = WebInspector.breakpointManager; this._javaScriptSource = javaScriptSource; - this._scriptFile = this._javaScriptSource.scriptFile(); var locations = this._breakpointManager.breakpointLocationsForUISourceCode(this._javaScriptSource); for (var i = 0; i < locations.length; ++i) @@ -57,9 +56,7 @@ WebInspector.JavaScriptSourceFrame = function(scriptsPanel, javaScriptSource) this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this); this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this); - this._javaScriptSource.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._onFormattedChanged, this); - this._javaScriptSource.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._onWorkingCopyChanged, this); - this._javaScriptSource.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyCommitted, this); + this._javaScriptSource.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._onContentChanged, this); this._javaScriptSource.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageAdded, this._consoleMessageAdded, this); this._javaScriptSource.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageRemoved, this._consoleMessageRemoved, this); this._javaScriptSource.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessagesCleared, this._consoleMessagesCleared, this); @@ -95,40 +92,18 @@ WebInspector.JavaScriptSourceFrame.prototype = { return; this._isCommittingEditing = true; - var breakpoints = this._getBreakpointDecorations(); - this._javaScriptSource.commitWorkingCopy(this._didEditContent.bind(this, breakpoints)); + this._javaScriptSource.commitWorkingCopy(this._didEditContent.bind(this)); delete this._isCommittingEditing; }, /** * @param {WebInspector.Event} event */ - _onFormattedChanged: function(event) + _onContentChanged: function(event) { - var content = /** @type {string} */ event.data.content; - this._innerSetContent(content); - }, - - /** - * @param {WebInspector.Event} event - */ - _onWorkingCopyChanged: function(event) - { - this._innerSetContent(this._javaScriptSource.workingCopy()); - }, - - /** - * @param {WebInspector.Event} event - */ - _onWorkingCopyCommitted: function(event) - { - this._innerSetContent(this._javaScriptSource.workingCopy()); - }, - - _innerSetContent: function(content) - { - if (this._isSettingWorkingCopy || this._isCommittingEditing) + if (this._isCommittingEditing) return; + var content = /** @type {string} */ event.data.content; if (this._javaScriptSource.togglingFormatter()) this.setContent(content, false, this._javaScriptSource.mimeType()); @@ -177,88 +152,57 @@ WebInspector.JavaScriptSourceFrame.prototype = { onTextChanged: function(oldRange, newRange) { WebInspector.SourceFrame.prototype.onTextChanged.call(this, oldRange, newRange); - - var wasDiverged = this._scriptFile && this._scriptFile.hasDivergedFromVM(); - - this._preserveDecorations = true; - this._isSettingWorkingCopy = true; + this._removeBreakpointsBeforeEditing(); this._javaScriptSource.setWorkingCopy(this._textEditor.text()); - delete this._isSettingWorkingCopy; - delete this._preserveDecorations; - - if (this._supportsEnabledBreakpointsWhileEditing()) - return; - - var isDiverged = this._scriptFile && this._scriptFile.hasDivergedFromVM(); - if (!wasDiverged && isDiverged) - this._muteBreakpointsWhileEditing(); - else if (wasDiverged && !isDiverged) { - var breakpoints = this._getBreakpointDecorations(); - this._restoreBreakpointsAfterEditing(breakpoints); - } - }, - - _getBreakpointDecorations: function() - { - var breakpoints = {}; - // Restore all muted breakpoints. - for (var lineNumber = 0; lineNumber < this._textEditor.linesCount; ++lineNumber) { - var breakpointDecoration = this._textEditor.getAttribute(lineNumber, "breakpoint"); - if (breakpointDecoration) - breakpoints[lineNumber] = breakpointDecoration; - } - - return breakpoints; + this._restoreBreakpointsAfterEditing(); }, - _muteBreakpointsWhileEditing: function() + _didEditContent: function(error) { - var breakpoints = this._getBreakpointDecorations(); - for (var lineNumber = 0; lineNumber < this._textEditor.linesCount; ++lineNumber) { - var breakpointDecoration = this._textEditor.getAttribute(lineNumber, "breakpoint"); - if (!breakpointDecoration) - continue; - this._removeBreakpointDecoration(lineNumber); - this._addBreakpointDecoration(lineNumber, breakpointDecoration.condition, breakpointDecoration.enabled, true); - } - }, - - _supportsEnabledBreakpointsWhileEditing: function() - { - return this._javaScriptSource.isSnippet; - }, - - _didEditContent: function(breakpoints, error) - { - if (!this._supportsEnabledBreakpointsWhileEditing()) - this._restoreBreakpointsAfterEditing(breakpoints); - if (error) { WebInspector.showErrorMessage(error); return; } + if (!this._javaScriptSource.supportsEnabledBreakpointsWhileEditing()) + this._restoreBreakpointsAfterEditing(); }, - _restoreBreakpointsAfterEditing: function(breakpoints) + _removeBreakpointsBeforeEditing: function() { - var breakpointLocations = this._breakpointManager.breakpointLocationsForUISourceCode(this._javaScriptSource); - var lineNumbers = {}; - for (var i = 0; i < breakpointLocations.length; ++i) { - var breakpoint = breakpointLocations[i].breakpoint; - breakpointLocations[i].breakpoint.remove(); - } + var supportsBreakpointsOnEdit = this._javaScriptSource.supportsEnabledBreakpointsWhileEditing(); + if (!this._javaScriptSource.isDirty() || supportsBreakpointsOnEdit) { + // Disable all breakpoints in the model, store them as muted breakpoints. + var breakpointLocations = this._breakpointManager.breakpointLocationsForUISourceCode(this._javaScriptSource); + var lineNumbers = {}; + this._preserveDecorations = true; + for (var i = 0; i < breakpointLocations.length; ++i) { + var breakpoint = breakpointLocations[i].breakpoint; + breakpointLocations[i].breakpoint.remove(); + } + delete this._preserveDecorations; - for (var lineNumber = 0; lineNumber < this._textEditor.linesCount; ++lineNumber) - this._removeBreakpointDecoration(lineNumber); + for (var lineNumber = 0; lineNumber < this._textEditor.linesCount; ++lineNumber) { + var breakpointDecoration = this._textEditor.getAttribute(lineNumber, "breakpoint"); + if (breakpointDecoration) + this._addBreakpointDecoration(lineNumber, breakpointDecoration.condition, breakpointDecoration.enabled, !supportsBreakpointsOnEdit); + } + this.clearExecutionLine(); + } + }, - // Restore all muted breakpoints. - for (var lineNumberString in breakpoints) { - var lineNumber = parseInt(lineNumberString, 10); - if (isNaN(lineNumber)) - continue; - var breakpointDecoration = breakpoints[lineNumberString]; - // Set new breakpoint - this._setBreakpoint(lineNumber, breakpointDecoration.condition, breakpointDecoration.enabled); + _restoreBreakpointsAfterEditing: function() + { + if (!this._javaScriptSource.isDirty() || this._javaScriptSource.supportsEnabledBreakpointsWhileEditing()) { + // Restore all muted breakpoints. + for (var lineNumber = 0; lineNumber < this._textEditor.linesCount; ++lineNumber) { + var breakpointDecoration = this._textEditor.getAttribute(lineNumber, "breakpoint"); + if (breakpointDecoration) { + // Remove fake decoration + this._removeBreakpointDecoration(lineNumber); + // Set new breakpoint + this._setBreakpoint(lineNumber, breakpointDecoration.condition, breakpointDecoration.enabled); + } + } } }, @@ -387,15 +331,13 @@ WebInspector.JavaScriptSourceFrame.prototype = { */ _addBreakpointDecoration: function(lineNumber, condition, enabled, mutedWhileEditing) { - if (this._preserveDecorations) - return; var breakpoint = { condition: condition, enabled: enabled }; this.textEditor.setAttribute(lineNumber, "breakpoint", breakpoint); - var disabled = !enabled || mutedWhileEditing; + var disabled = !enabled || (mutedWhileEditing && !this._javaScriptSource.supportsEnabledBreakpointsWhileEditing()); this.textEditor.addBreakpoint(lineNumber, disabled, !!condition); }, @@ -572,7 +514,7 @@ WebInspector.JavaScriptSourceFrame.prototype = { */ _handleGutterClick: function(event) { - if (this._javaScriptSource.isDirty() && !this._supportsEnabledBreakpointsWhileEditing()) + if (this._javaScriptSource.isDirty() && !this._javaScriptSource.supportsEnabledBreakpointsWhileEditing()) return; var lineNumber = event.data.lineNumber; @@ -624,9 +566,9 @@ WebInspector.JavaScriptSourceFrame.prototype = { */ _continueToLine: function(lineNumber) { - var rawLocation = /** @type {WebInspector.DebuggerModel.Location} */ this._javaScriptSource.uiLocationToRawLocation(lineNumber, 0); + var rawLocation = this._javaScriptSource.uiLocationToRawLocation(lineNumber, 0); WebInspector.debuggerModel.continueToLocation(rawLocation); - }, - - __proto__: WebInspector.SourceFrame.prototype + } } + +WebInspector.JavaScriptSourceFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype; diff --git a/Source/WebCore/inspector/front-end/Linkifier.js b/Source/WebCore/inspector/front-end/Linkifier.js index c668a45c6..91986bdae 100644 --- a/Source/WebCore/inspector/front-end/Linkifier.js +++ b/Source/WebCore/inspector/front-end/Linkifier.js @@ -125,7 +125,7 @@ WebInspector.Linkifier.DefaultFormatter.prototype = { if (this._maxLength) text = text.trimMiddle(this._maxLength); anchor.textContent = text; - }, - - __proto__: WebInspector.LinkifierFormatter.prototype + } } + +WebInspector.Linkifier.DefaultFormatter.prototype.__proto__ = WebInspector.LinkifierFormatter.prototype; diff --git a/Source/WebCore/inspector/front-end/MemoryStatistics.js b/Source/WebCore/inspector/front-end/MemoryStatistics.js index e75cd02b3..b4596e194 100644 --- a/Source/WebCore/inspector/front-end/MemoryStatistics.js +++ b/Source/WebCore/inspector/front-end/MemoryStatistics.js @@ -126,11 +126,11 @@ WebInspector.SwatchCheckbox.prototype = { { this.checked = !this.checked; this.dispatchEventToListeners(WebInspector.SwatchCheckbox.Events.Changed); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.SwatchCheckbox.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor */ diff --git a/Source/WebCore/inspector/front-end/MetricsSidebarPane.js b/Source/WebCore/inspector/front-end/MetricsSidebarPane.js index b29343031..b1d8ab36e 100644 --- a/Source/WebCore/inspector/front-end/MetricsSidebarPane.js +++ b/Source/WebCore/inspector/front-end/MetricsSidebarPane.js @@ -419,7 +419,7 @@ WebInspector.MetricsSidebarPane.prototype = { { this.editingEnded(element, context); this._applyUserInput(element, userInput, previousContent, context, true); - }, - - __proto__: WebInspector.SidebarPane.prototype + } } + +WebInspector.MetricsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/NativeBreakpointsSidebarPane.js b/Source/WebCore/inspector/front-end/NativeBreakpointsSidebarPane.js index 8c34ac6f8..e6154745a 100644 --- a/Source/WebCore/inspector/front-end/NativeBreakpointsSidebarPane.js +++ b/Source/WebCore/inspector/front-end/NativeBreakpointsSidebarPane.js @@ -76,7 +76,7 @@ WebInspector.NativeBreakpointsSidebarPane.prototype = { this.bodyElement.removeChild(this.listElement); this.bodyElement.appendChild(this.emptyElement); } - }, - - __proto__: WebInspector.SidebarPane.prototype + } } + +WebInspector.NativeBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js index 1c0cb67fd..e32959268 100644 --- a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js +++ b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js @@ -57,11 +57,11 @@ WebInspector.NativeMemorySnapshotView.prototype = { get profile() { return this._profile; - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.NativeMemorySnapshotView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.ProfileType} @@ -145,11 +145,11 @@ WebInspector.NativeMemoryProfileType.prototype = { createProfile: function(profile) { return new WebInspector.NativeMemoryProfileHeader(this, profile.title, -1); - }, - - __proto__: WebInspector.ProfileType.prototype + } } +WebInspector.NativeMemoryProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype; + /** * @constructor * @extends {WebInspector.ProfileHeader} @@ -183,11 +183,11 @@ WebInspector.NativeMemoryProfileHeader.prototype = { createView: function(profilesPanel) { return new WebInspector.NativeMemorySnapshotView(this); - }, - - __proto__: WebInspector.ProfileHeader.prototype + } } +WebInspector.NativeMemoryProfileHeader.prototype.__proto__ = WebInspector.ProfileHeader.prototype; + /** * @constructor * @param {string} fillStyle @@ -219,17 +219,17 @@ WebInspector.MemoryBlockViewProperties._initialize = function() addBlock("hsl( 0, 0%, 80%)", "OwnersTypePlaceholder", "OwnersTypePlaceholder"); addBlock("hsl( 0, 0%, 80%)", "Other", "Other"); addBlock("hsl(300, 30%, 80%)", "Page", "Page's structures"); - addBlock("hsl( 90, 60%, 80%)", "JSHeap", "JavaScript heap"); - addBlock("hsl( 90, 80%, 80%)", "JSHeap.Used", "Used JavaScript heap"); + addBlock("hsl( 90, 60%, 80%)", "JSHeapAllocated", "JavaScript heap"); + addBlock("hsl( 90, 80%, 80%)", "JSHeapUsed", "Used JavaScript heap"); addBlock("hsl( 90, 30%, 80%)", "JSExternalResources", "JavaScript external resources"); addBlock("hsl( 90, 40%, 80%)", "JSExternalArrays", "JavaScript external arrays"); addBlock("hsl( 90, 50%, 80%)", "JSExternalStrings", "JavaScript external strings"); - addBlock("hsl(210, 60%, 80%)", "WebInspector", "Inspector data"); + addBlock("hsl(210, 60%, 80%)", "InspectorData", "Inspector data"); addBlock("hsl( 30, 60%, 80%)", "MemoryCache", "Memory cache resources"); addBlock("hsl( 40, 60%, 80%)", "GlyphCache", "Glyph cache resources"); addBlock("hsl( 35, 60%, 80%)", "DOMStorageCache", "DOM storage cache"); - addBlock("hsl( 60, 60%, 80%)", "RenderTree", "Render tree"); - addBlock("hsl( 60, 60%, 80%)", "RenderTree.Used", "Render tree used"); + addBlock("hsl( 60, 60%, 80%)", "RenderTreeAllocated", "Render tree"); + addBlock("hsl( 60, 60%, 80%)", "RenderTreeUsed", "Render tree used"); } WebInspector.MemoryBlockViewProperties._forMemoryBlock = function(memoryBlock) @@ -369,11 +369,11 @@ WebInspector.NativeMemoryPieChart.prototype = { _clear: function() { var ctx = this._canvas.getContext("2d"); ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.NativeMemoryPieChart.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.View} @@ -474,13 +474,9 @@ WebInspector.NativeMemoryBarChart.prototype = { } var unusedSize = 0; if (!!child.children) { - var unusedName = name + ".Unused"; - for (var j = 0; j < child.children.length; ++j) { - if (child.children[j].name === unusedName) { - unusedSize = child.children[j].size; - break; - } - } + unusedSize = child.size; + for (var j = 0; j < child.children.length; ++j) + unusedSize -= child.children[j].size; } var unusedLength = unusedSize * barLengthSizeRatio; var barLength = child.size * barLengthSizeRatio; @@ -493,7 +489,7 @@ WebInspector.NativeMemoryBarChart.prototype = { var memoryBlockViewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(memoryBlock); this._totalDiv.textContent = memoryBlockViewProperties._description + ": " + (memoryBlock.size / MB).toFixed(1) + "\u2009MB"; - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.NativeMemoryBarChart.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/NavigatorView.js b/Source/WebCore/inspector/front-end/NavigatorView.js index 97f88e8e5..a02217474 100644 --- a/Source/WebCore/inspector/front-end/NavigatorView.js +++ b/Source/WebCore/inspector/front-end/NavigatorView.js @@ -94,13 +94,7 @@ WebInspector.NavigatorView.prototype = { this._updateScriptTitle(uiSourceCode) }, - _uiSourceCodeWorkingCopyCommitted: function(event) - { - var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.target; - this._updateScriptTitle(uiSourceCode) - }, - - _uiSourceCodeFormattedChanged: function(event) + _uiSourceCodeContentChanged: function(event) { var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.target; this._updateScriptTitle(uiSourceCode); @@ -155,6 +149,29 @@ WebInspector.NavigatorView.prototype = { }, /** + * @param {WebInspector.UISourceCode} oldUISourceCode + * @param {WebInspector.UISourceCode} uiSourceCode + */ + replaceUISourceCode: function(oldUISourceCode, uiSourceCode) + { + var added = false; + var selected = false; + if (this._scriptTreeElementsByUISourceCode.get(oldUISourceCode)) { + added = true; + + if (this._lastSelectedUISourceCode === oldUISourceCode) + selected = true; + this.removeUISourceCode(oldUISourceCode); + } + + if (!added) + return; + this.addUISourceCode(uiSourceCode); + if (selected) + this.revealUISourceCode(uiSourceCode); + }, + + /** * @param {WebInspector.UISourceCode} uiSourceCode * @param {boolean} focusSource */ @@ -193,8 +210,7 @@ WebInspector.NavigatorView.prototype = { { uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this); uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._uiSourceCodeWorkingCopyChanged, this); - uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._uiSourceCodeWorkingCopyCommitted, this); - uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._uiSourceCodeFormattedChanged, this); + uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._uiSourceCodeContentChanged, this); }, /** @@ -204,8 +220,7 @@ WebInspector.NavigatorView.prototype = { { uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this); uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._uiSourceCodeWorkingCopyChanged, this); - uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._uiSourceCodeWorkingCopyCommitted, this); - uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._uiSourceCodeFormattedChanged, this); + uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._uiSourceCodeContentChanged, this); }, _showScriptFoldersSettingChanged: function() @@ -332,11 +347,11 @@ WebInspector.NavigatorView.prototype = { var contextMenu = new WebInspector.ContextMenu(); contextMenu.appendApplicableItems(uiSourceCode); contextMenu.show(event); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.NavigatorView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {TreeOutline} @@ -414,11 +429,11 @@ WebInspector.NavigatorTreeOutline.prototype = { { this._treeSearchBoxElement.removeChild(this.searchInputElement); this._treeSearchBoxElement.removeStyleClass("visible"); - }, - - __proto__: TreeOutline.prototype + } } +WebInspector.NavigatorTreeOutline.prototype.__proto__ = TreeOutline.prototype; + /** * @constructor * @extends {TreeElement} @@ -490,11 +505,11 @@ WebInspector.BaseNavigatorTreeElement.prototype = { matchesSearchText: function(searchText) { return this.titleText.match(new RegExp("^" + searchText.escapeForRegExp(), "i")); - }, - - __proto__: TreeElement.prototype + } } +WebInspector.BaseNavigatorTreeElement.prototype.__proto__ = TreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseNavigatorTreeElement} @@ -538,11 +553,11 @@ WebInspector.NavigatorFolderTreeElement.prototype = { this.collapse(); else this.expand(); - }, - - __proto__: WebInspector.BaseNavigatorTreeElement.prototype + } } +WebInspector.NavigatorFolderTreeElement.prototype.__proto__ = WebInspector.BaseNavigatorTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseNavigatorTreeElement} @@ -630,7 +645,7 @@ WebInspector.NavigatorSourceTreeElement.prototype = { _handleContextMenuEvent: function(event) { this._navigatorView.handleContextMenu(event, this._uiSourceCode); - }, - - __proto__: WebInspector.BaseNavigatorTreeElement.prototype + } } + +WebInspector.NavigatorSourceTreeElement.prototype.__proto__ = WebInspector.BaseNavigatorTreeElement.prototype; diff --git a/Source/WebCore/inspector/front-end/NetworkItemView.js b/Source/WebCore/inspector/front-end/NetworkItemView.js index 91b95130c..45cdfaba4 100644 --- a/Source/WebCore/inspector/front-end/NetworkItemView.js +++ b/Source/WebCore/inspector/front-end/NetworkItemView.js @@ -100,11 +100,11 @@ WebInspector.NetworkItemView.prototype = { request: function() { return this._request; - }, - - __proto__: WebInspector.TabbedPane.prototype + } } +WebInspector.NetworkItemView.prototype.__proto__ = WebInspector.TabbedPane.prototype; + /** * @constructor * @extends {WebInspector.RequestView} @@ -170,7 +170,7 @@ WebInspector.RequestContentView.prototype = { { if (this.canHighlightLine()) this._innerView.highlightLine(line); - }, - - __proto__: WebInspector.RequestView.prototype + } } + +WebInspector.RequestContentView.prototype.__proto__ = WebInspector.RequestView.prototype; diff --git a/Source/WebCore/inspector/front-end/NetworkManager.js b/Source/WebCore/inspector/front-end/NetworkManager.js index e56c7ebd5..ddfd953e4 100644 --- a/Source/WebCore/inspector/front-end/NetworkManager.js +++ b/Source/WebCore/inspector/front-end/NetworkManager.js @@ -113,11 +113,11 @@ WebInspector.NetworkManager.prototype = { _userAgentSettingChanged: function() { NetworkAgent.setUserAgentOverride(WebInspector.settings.userAgent.get()); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.NetworkManager.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {NetworkAgent.Dispatcher} diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 52848639c..5fb8982ac 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -1261,11 +1261,10 @@ WebInspector.NetworkLogView.prototype = { { node.element.addStyleClass("highlighted-row"); this._highlightedNode = node; - }, - - __proto__: WebInspector.View.prototype -} + } +}; +WebInspector.NetworkLogView.prototype.__proto__ = WebInspector.View.prototype; WebInspector.NetworkLogView.EventTypes = { ViewCleared: "ViewCleared", @@ -1521,11 +1520,11 @@ WebInspector.NetworkPanel.prototype = { this.revealAndHighlightRequest(/** @type {WebInspector.NetworkRequest} */ target); } contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Reveal in network panel" : "Reveal in Network Panel"), reveal.bind(this)); - }, - - __proto__: WebInspector.Panel.prototype + } } +WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; + /** * @constructor * @implements {WebInspector.TimelineGrid.Calculator} @@ -1726,11 +1725,11 @@ WebInspector.NetworkTimeCalculator.prototype = { _upperBound: function(request) { return 0; - }, - - __proto__: WebInspector.NetworkBaseCalculator.prototype + } } +WebInspector.NetworkTimeCalculator.prototype.__proto__ = WebInspector.NetworkBaseCalculator.prototype; + /** * @constructor * @extends {WebInspector.NetworkTimeCalculator} @@ -1754,11 +1753,11 @@ WebInspector.NetworkTransferTimeCalculator.prototype = { _upperBound: function(request) { return request.endTime; - }, - - __proto__: WebInspector.NetworkTimeCalculator.prototype + } } +WebInspector.NetworkTransferTimeCalculator.prototype.__proto__ = WebInspector.NetworkTimeCalculator.prototype; + /** * @constructor * @extends {WebInspector.NetworkTimeCalculator} @@ -1777,11 +1776,11 @@ WebInspector.NetworkTransferDurationCalculator.prototype = { _upperBound: function(request) { return request.duration; - }, - - __proto__: WebInspector.NetworkTimeCalculator.prototype + } } +WebInspector.NetworkTransferDurationCalculator.prototype.__proto__ = WebInspector.NetworkTimeCalculator.prototype; + /** * @constructor * @extends {WebInspector.DataGridNode} @@ -1943,8 +1942,8 @@ WebInspector.NetworkDataGridNode.prototype = { _fileName: function() { var fileName = this._request.displayName; - if (this._request.queryString()) - fileName += "?" + this._request.queryString(); + if (this._request.queryString) + fileName += "?" + this._request.queryString; return fileName; }, @@ -2165,16 +2164,13 @@ WebInspector.NetworkDataGridNode.prototype = { this._labelRightElement.style.setProperty("left", this._percentages.middle + "%"); this._labelRightElement.style.setProperty("right", (100 - this._percentages.end) + "%"); } - }, - - __proto__: WebInspector.DataGridNode.prototype + } } - WebInspector.NetworkDataGridNode.NameComparator = function(a, b) { - var aFileName = a._request.displayName + (a._request.queryString() ? a._request.queryString() : ""); - var bFileName = b._request.displayName + (b._request.queryString() ? b._request.queryString() : ""); + var aFileName = a._request.displayName + (a._request.queryString ? a._request.queryString : ""); + var bFileName = b._request.displayName + (b._request.queryString ? b._request.queryString : ""); if (aFileName > bFileName) return 1; if (bFileName > aFileName) @@ -2220,3 +2216,5 @@ WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa return revert ? 1 : -1; return 0; } + +WebInspector.NetworkDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; diff --git a/Source/WebCore/inspector/front-end/NetworkPanelDescriptor.js b/Source/WebCore/inspector/front-end/NetworkPanelDescriptor.js index 1621d77d0..4a4fecfd2 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanelDescriptor.js +++ b/Source/WebCore/inspector/front-end/NetworkPanelDescriptor.js @@ -48,7 +48,7 @@ WebInspector.NetworkPanelDescriptor.prototype = { if (!(target instanceof WebInspector.NetworkRequest)) return; this.panel().appendApplicableItems(contextMenu, target); - }, - - __proto__: WebInspector.PanelDescriptor.prototype + } } + +WebInspector.NetworkPanelDescriptor.prototype.__proto__ = WebInspector.PanelDescriptor.prototype; diff --git a/Source/WebCore/inspector/front-end/NetworkRequest.js b/Source/WebCore/inspector/front-end/NetworkRequest.js index 961c55e23..464d9fbeb 100644 --- a/Source/WebCore/inspector/front-end/NetworkRequest.js +++ b/Source/WebCore/inspector/front-end/NetworkRequest.js @@ -55,6 +55,7 @@ WebInspector.NetworkRequest = function(requestId, url, documentURL, frameId, loa this.receiveHeadersEnd = 0; this._type = WebInspector.resourceTypes.Other; + this._content = undefined; this._contentEncoded = false; this._pendingContentCallbacks = []; this._frames = []; @@ -578,29 +579,16 @@ WebInspector.NetworkRequest.prototype = { }, /** - * @return {?string} - */ - queryString: function() - { - if (this._queryString) - return this._queryString; - var queryString = this.url.split("?", 2)[1]; - if (!queryString) - return null; - this._queryString = queryString.split("#", 2)[0]; - return this._queryString; - }, - - /** * @return {?Array.<Object>} */ get queryParameters() { if (this._parsedQueryParameters) return this._parsedQueryParameters; - var queryString = this.queryString(); + var queryString = this.url.split("?", 2)[1]; if (!queryString) return null; + queryString = queryString.split("#", 2)[0]; this._parsedQueryParameters = this._parseParameters(queryString); return this._parsedQueryParameters; }, @@ -688,7 +676,7 @@ WebInspector.NetworkRequest.prototype = { }, /** - * @return {string} + * @return {?string} */ contentURL: function() { @@ -773,30 +761,22 @@ WebInspector.NetworkRequest.prototype = { populateImageSource: function(image) { /** - * @this {WebInspector.NetworkRequest} * @param {?string} content * @param {boolean} contentEncoded * @param {string} mimeType */ function onResourceContent(content, contentEncoded, mimeType) { - var imageSrc = this.asDataURL(); - if (imageSrc === null) - imageSrc = this.url; - image.src = imageSrc; + const maxDataUrlSize = 1024 * 1024; + // If resource content is not available or won't fit a data URL, fall back to using original URL. + if (this._content == null || this._content.length > maxDataUrlSize) + return this.url; + image.src = "data:" + this.mimeType + (this._contentEncoded ? ";base64," : ",") + this._content; } this.requestContent(onResourceContent.bind(this)); }, - /** - * @return {?string} - */ - asDataURL: function() - { - return WebInspector.contentAsDataURL(this._content, this.mimeType, this._contentEncoded); - }, - _innerRequestContent: function() { if (this._contentRequested) @@ -869,7 +849,7 @@ WebInspector.NetworkRequest.prototype = { this._frames.splice(0, 10); } this._frames.push(object); - }, - - __proto__: WebInspector.Object.prototype + } } + +WebInspector.NetworkRequest.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js b/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js index fa3eadd1e..f1625f64c 100644 --- a/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js +++ b/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js @@ -38,7 +38,6 @@ WebInspector.NetworkUISourceCodeProvider = function(workspace) WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._projectWillReset, this); this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectDidReset, this._projectDidReset, this); - WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this); this._uiSourceCodeForResource = {}; } @@ -62,29 +61,6 @@ WebInspector.NetworkUISourceCodeProvider.prototype = { /** * @param {WebInspector.Event} event */ - _parsedScriptSource: function(event) - { - var script = /** @type {WebInspector.Script} */ event.data; - if (!script.hasSourceURL && !script.isContentScript) - return; - if (!script.sourceURL) - return; - // Filter out embedder injected content scripts. - if (script.isContentScript && !script.hasSourceURL) { - var parsedURL = new WebInspector.ParsedURL(script.sourceURL); - if (!parsedURL.host) - return; - } - if (this._uiSourceCodeForResource[script.sourceURL]) - return; - var uiSourceCode = new WebInspector.JavaScriptSource(script.sourceURL, script, true); - this._uiSourceCodeForResource[script.sourceURL] = uiSourceCode; - this._workspace.project().addUISourceCode(uiSourceCode); - }, - - /** - * @param {WebInspector.Event} event - */ _resourceAdded: function(event) { var resource = /** @type {WebInspector.Resource} */ event.data; @@ -96,10 +72,10 @@ WebInspector.NetworkUISourceCodeProvider.prototype = { uiSourceCode = new WebInspector.StyleSource(resource); break; case WebInspector.resourceTypes.Document: - uiSourceCode = new WebInspector.JavaScriptSource(resource.url, resource, false); + uiSourceCode = new WebInspector.JavaScriptSource(resource.url, resource, resource, false); break; case WebInspector.resourceTypes.Script: - uiSourceCode = new WebInspector.JavaScriptSource(resource.url, resource, true); + uiSourceCode = new WebInspector.JavaScriptSource(resource.url, resource, resource, true); break; } if (uiSourceCode) { diff --git a/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js b/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js index 380f4db8f..c4f425e68 100644 --- a/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js +++ b/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js @@ -153,7 +153,7 @@ WebInspector.ObjectPopoverHelper.prototype = { } } this._sectionUpdateProperties(properties, rootTreeElementConstructor, rootPropertyComparer); - }, - - __proto__: WebInspector.PopoverHelper.prototype + } } + +WebInspector.ObjectPopoverHelper.prototype.__proto__ = WebInspector.PopoverHelper.prototype; diff --git a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js index 9c8587807..c58ff53fe 100644 --- a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js +++ b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js @@ -123,11 +123,11 @@ WebInspector.ObjectPropertiesSection.prototype = { var infoElement = new TreeElement(title, null, false); this.propertiesTreeOutline.appendChild(infoElement); } - }, - - __proto__: WebInspector.PropertiesSection.prototype + } } +WebInspector.ObjectPropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; + WebInspector.ObjectPropertiesSection.CompareProperties = function(propertyA, propertyB) { var a = propertyA.name; @@ -370,9 +370,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { } }; this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback.bind(this)); - }, - - __proto__: TreeElement.prototype + } } /** @@ -409,6 +407,8 @@ WebInspector.ObjectPropertyTreeElement.populate = function(treeElement, value) { value.getOwnProperties(callback); } +WebInspector.ObjectPropertyTreeElement.prototype.__proto__ = TreeElement.prototype; + /** * @constructor * @extends {TreeElement} @@ -482,10 +482,10 @@ WebInspector.FunctionScopeMainTreeElement.prototype = { } DebuggerAgent.getFunctionDetails(this._remoteObject.objectId, didGetDetails.bind(this)); - }, + } +}; - __proto__: TreeElement.prototype -} +WebInspector.FunctionScopeMainTreeElement.prototype.__proto__ = TreeElement.prototype; /** * @constructor @@ -506,10 +506,10 @@ WebInspector.ScopeTreeElement.prototype = { onpopulate: function() { return WebInspector.ObjectPropertyTreeElement.populate(this, this._remoteObject); - }, + } +}; - __proto__: TreeElement.prototype -} +WebInspector.ScopeTreeElement.prototype.__proto__ = TreeElement.prototype; /** * @constructor @@ -730,11 +730,11 @@ WebInspector.ArrayGroupingTreeElement.prototype = { onattach: function() { this.listItemElement.addStyleClass("name"); - }, - - __proto__: TreeElement.prototype + } } +WebInspector.ArrayGroupingTreeElement.prototype.__proto__ = TreeElement.prototype; + /** * @constructor * @extends {WebInspector.TextPrompt} @@ -742,12 +742,11 @@ WebInspector.ArrayGroupingTreeElement.prototype = { */ WebInspector.ObjectPropertyPrompt = function(commitHandler, cancelHandler, renderAsBlock) { - WebInspector.TextPrompt.call(this, WebInspector.runtimeModel.completionsForTextPrompt.bind(WebInspector.runtimeModel)); + const ExpressionStopCharacters = " =:[({;,!+-*/&|^<>."; // Same as in ConsoleView.js + "." + WebInspector.TextPrompt.call(this, WebInspector.consoleView.completionsForTextPrompt.bind(WebInspector.consoleView), ExpressionStopCharacters); this.setSuggestBoxEnabled("generic-suggest"); if (renderAsBlock) this.renderAsBlock(); } -WebInspector.ObjectPropertyPrompt.prototype = { - __proto__: WebInspector.TextPrompt.prototype -} +WebInspector.ObjectPropertyPrompt.prototype.__proto__ = WebInspector.TextPrompt.prototype; diff --git a/Source/WebCore/inspector/front-end/Panel.js b/Source/WebCore/inspector/front-end/Panel.js index f05db2044..8cee1761c 100644 --- a/Source/WebCore/inspector/front-end/Panel.js +++ b/Source/WebCore/inspector/front-end/Panel.js @@ -247,11 +247,11 @@ WebInspector.Panel.prototype = { unregisterShortcut: function(key) { delete this._shortcuts[key]; - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.Panel.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @param {string} name diff --git a/Source/WebCore/inspector/front-end/PanelEnablerView.js b/Source/WebCore/inspector/front-end/PanelEnablerView.js index feab74a44..5e762b862 100644 --- a/Source/WebCore/inspector/front-end/PanelEnablerView.js +++ b/Source/WebCore/inspector/front-end/PanelEnablerView.js @@ -94,7 +94,7 @@ WebInspector.PanelEnablerView.prototype = { get alwaysEnabled() { return this.enabledAlways.checked; - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.PanelEnablerView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/ProfileDataGridTree.js b/Source/WebCore/inspector/front-end/ProfileDataGridTree.js index 284f3b87a..ccbc7f098 100644 --- a/Source/WebCore/inspector/front-end/ProfileDataGridTree.js +++ b/Source/WebCore/inspector/front-end/ProfileDataGridTree.js @@ -294,11 +294,11 @@ WebInspector.ProfileDataGridNode.prototype = { else this.appendChild(orphanedChild); } - }, - - __proto__: WebInspector.DataGridNode.prototype + } } +WebInspector.ProfileDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; + /** * @constructor */ diff --git a/Source/WebCore/inspector/front-end/ProfileLauncherView.js b/Source/WebCore/inspector/front-end/ProfileLauncherView.js index 67726f47c..cfe22bee9 100644 --- a/Source/WebCore/inspector/front-end/ProfileLauncherView.js +++ b/Source/WebCore/inspector/front-end/ProfileLauncherView.js @@ -127,7 +127,7 @@ WebInspector.ProfileLauncherView.prototype = { { this._isProfiling = false; this._updateControls(); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.ProfileLauncherView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js index 1e594e2f0..d0d20aa69 100644 --- a/Source/WebCore/inspector/front-end/ProfilesPanel.js +++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js @@ -428,14 +428,11 @@ WebInspector.ProfilesPanel.prototype = { element.treeElement.handleContextMenuEvent(event); return; } - if (element !== this.element || event.srcElement === this.sidebarElement) { - var contextMenu = new WebInspector.ContextMenu(); - if (this.visibleView instanceof WebInspector.HeapSnapshotView) - this.visibleView.populateContextMenu(contextMenu, event); - contextMenu.appendItem(WebInspector.UIString("Load Heap Snapshot\u2026"), this._fileSelectorElement.click.bind(this._fileSelectorElement)); - contextMenu.show(event); - } - + var contextMenu = new WebInspector.ContextMenu(); + if (this.visibleView instanceof WebInspector.HeapSnapshotView) + this.visibleView.populateContextMenu(contextMenu, event); + contextMenu.appendItem(WebInspector.UIString("Load profile\u2026"), this._fileSelectorElement.click.bind(this._fileSelectorElement)); + contextMenu.show(event); }, /** @@ -674,7 +671,7 @@ WebInspector.ProfilesPanel.prototype = { var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)]; if (!profile) return; - profile.finishHeapSnapshot(); + profile.finishHeapSnapshot(false); }, /** @@ -1115,11 +1112,11 @@ WebInspector.ProfilesPanel.prototype = { contextMenu.appendItem(WebInspector.UIString("Reveal in Dominators View"), revealInView.bind(this, "Dominators")); contextMenu.appendItem(WebInspector.UIString("Reveal in Summary View"), revealInView.bind(this, "Summary")); - }, - - __proto__: WebInspector.Panel.prototype + } } +WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype; + /** * @constructor * @implements {ProfilerAgent.Dispatcher} @@ -1249,22 +1246,18 @@ WebInspector.ProfileSidebarTreeElement.prototype = { { var profile = this.profile; var contextMenu = new WebInspector.ContextMenu(); - var profilesPanel = WebInspector.ProfilesPanel._instance; + if (profile.canSaveToFile()) + contextMenu.appendItem(WebInspector.UIString("Save profile\u2026"), profile.saveToFile.bind(profile)); // FIXME: use context menu provider - if (profile.canSaveToFile()) { - contextMenu.appendItem(WebInspector.UIString("Save Heap Snapshot\u2026"), profile.saveToFile.bind(profile)); - contextMenu.appendItem(WebInspector.UIString("Load Heap Snapshot\u2026"), profilesPanel._fileSelectorElement.click.bind(profilesPanel._fileSelectorElement)); - contextMenu.appendItem(WebInspector.UIString("Delete Heap Snapshot"), this.ondelete.bind(this)); - } else { - contextMenu.appendItem(WebInspector.UIString("Load Heap Snapshot\u2026"), profilesPanel._fileSelectorElement.click.bind(profilesPanel._fileSelectorElement)); - contextMenu.appendItem(WebInspector.UIString("Delete profile"), this.ondelete.bind(this)); - } + var profilesPanel = WebInspector.ProfilesPanel._instance; + contextMenu.appendItem(WebInspector.UIString("Load profile\u2026"), profilesPanel._fileSelectorElement.click.bind(profilesPanel._fileSelectorElement)); + contextMenu.appendItem(WebInspector.UIString("Delete profile"), this.ondelete.bind(this)); contextMenu.show(event); - }, - - __proto__: WebInspector.SidebarTreeElement.prototype + } } +WebInspector.ProfileSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + /** * @constructor * @extends {WebInspector.SidebarTreeElement} @@ -1281,11 +1274,11 @@ WebInspector.ProfileGroupSidebarTreeElement.prototype = { { if (this.children.length > 0) WebInspector.ProfilesPanel._instance.showProfile(this.children[this.children.length - 1].profile); - }, - - __proto__: WebInspector.SidebarTreeElement.prototype + } } +WebInspector.ProfileGroupSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + /** * @constructor * @extends {WebInspector.SidebarTreeElement} @@ -1307,11 +1300,11 @@ WebInspector.ProfilesSidebarTreeElement.prototype = { get selectable() { return true; - }, - - __proto__: WebInspector.SidebarTreeElement.prototype + } } +WebInspector.ProfilesSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + importScript("ProfileDataGridTree.js"); importScript("BottomUpProfileDataGridTree.js"); importScript("CPUProfileView.js"); diff --git a/Source/WebCore/inspector/front-end/Progress.js b/Source/WebCore/inspector/front-end/ProgressBar.js index 4cd050891..22a4513f2 100644 --- a/Source/WebCore/inspector/front-end/Progress.js +++ b/Source/WebCore/inspector/front-end/ProgressBar.js @@ -67,6 +67,102 @@ WebInspector.Progress.prototype = { /** * @constructor + * @implements {WebInspector.Progress} + * @extends {WebInspector.Object} + */ +WebInspector.ProgressIndicator = function() +{ + this.element = document.createElement("div"); + this.element.className = "progress-bar-container"; + this._labelElement = this.element.createChild("span"); + this._progressElement = this.element.createChild("progress"); + this._stopButton = new WebInspector.StatusBarButton(WebInspector.UIString("Cancel"), "progress-bar-stop-button"); + this._stopButton.addEventListener("click", this.cancel, this); + this.element.appendChild(this._stopButton.element); + this._isCanceled = false; + this._worked = 0; +} + +WebInspector.ProgressIndicator.Events = { + Done: "Done" +} + +WebInspector.ProgressIndicator.prototype = { + /** + * @param {Element} parent + */ + show: function(parent) + { + parent.appendChild(this.element); + }, + + hide: function() + { + var parent = this.element.parentElement; + if (parent) + parent.removeChild(this.element); + }, + + done: function() + { + if (this._isDone) + return; + this._isDone = true; + this.hide(); + this.dispatchEventToListeners(WebInspector.ProgressIndicator.Events.Done); + }, + + cancel: function() + { + this._isCanceled = true; + }, + + isCanceled: function() + { + return this._isCanceled; + }, + + /** + * @param {string} title + */ + setTitle: function(title) + { + this._labelElement.textContent = title; + }, + + /** + * @param {number} totalWork + */ + setTotalWork: function(totalWork) + { + this._progressElement.max = totalWork; + }, + + /** + * @param {number} worked + * @param {string=} title + */ + setWorked: function(worked, title) + { + this._worked = worked; + this._progressElement.value = worked; + if (title) + this.setTitle(title); + }, + + /** + * @param {number=} worked + */ + worked: function(worked) + { + this.setWorked(this._worked + (worked || 1)); + } +} + +WebInspector.ProgressIndicator.prototype.__proto__ = WebInspector.Object.prototype; + +/** + * @constructor * @param {WebInspector.Progress} parent */ WebInspector.CompositeProgress = function(parent) diff --git a/Source/WebCore/inspector/front-end/ProgressIndicator.js b/Source/WebCore/inspector/front-end/ProgressIndicator.js deleted file mode 100644 index cb9d2ef23..000000000 --- a/Source/WebCore/inspector/front-end/ProgressIndicator.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS 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 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. - */ - -/** - * @constructor - * @implements {WebInspector.Progress} - * @extends {WebInspector.Object} - */ -WebInspector.ProgressIndicator = function() -{ - this.element = document.createElement("div"); - this.element.className = "progress-bar-container"; - this._labelElement = this.element.createChild("span"); - this._progressElement = this.element.createChild("progress"); - this._stopButton = new WebInspector.StatusBarButton(WebInspector.UIString("Cancel"), "progress-bar-stop-button"); - this._stopButton.addEventListener("click", this.cancel, this); - this.element.appendChild(this._stopButton.element); - this._isCanceled = false; - this._worked = 0; -} - -WebInspector.ProgressIndicator.Events = { - Done: "Done" -} - -WebInspector.ProgressIndicator.prototype = { - /** - * @param {Element} parent - */ - show: function(parent) - { - parent.appendChild(this.element); - }, - - hide: function() - { - var parent = this.element.parentElement; - if (parent) - parent.removeChild(this.element); - }, - - done: function() - { - if (this._isDone) - return; - this._isDone = true; - this.hide(); - this.dispatchEventToListeners(WebInspector.ProgressIndicator.Events.Done); - }, - - cancel: function() - { - this._isCanceled = true; - }, - - isCanceled: function() - { - return this._isCanceled; - }, - - /** - * @param {string} title - */ - setTitle: function(title) - { - this._labelElement.textContent = title; - }, - - /** - * @param {number} totalWork - */ - setTotalWork: function(totalWork) - { - this._progressElement.max = totalWork; - }, - - /** - * @param {number} worked - * @param {string=} title - */ - setWorked: function(worked, title) - { - this._worked = worked; - this._progressElement.value = worked; - if (title) - this.setTitle(title); - }, - - /** - * @param {number=} worked - */ - worked: function(worked) - { - this.setWorked(this._worked + (worked || 1)); - }, - - __proto__: WebInspector.Object.prototype -} diff --git a/Source/WebCore/inspector/front-end/PropertiesSection.js b/Source/WebCore/inspector/front-end/PropertiesSection.js index 3aa4fc446..4f760e68e 100644 --- a/Source/WebCore/inspector/front-end/PropertiesSection.js +++ b/Source/WebCore/inspector/front-end/PropertiesSection.js @@ -47,6 +47,4 @@ WebInspector.PropertiesSection = function(title, subtitle) this.element.appendChild(this.propertiesElement); } -WebInspector.PropertiesSection.prototype = { - __proto__: WebInspector.Section.prototype -} +WebInspector.PropertiesSection.prototype.__proto__ = WebInspector.Section.prototype; diff --git a/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js b/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js index 0f7bbf6d0..b2fbc527c 100644 --- a/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js +++ b/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js @@ -99,7 +99,7 @@ WebInspector.PropertiesSidebarPane.prototype = { body.appendChild(section.element); } } - }, - - __proto__: WebInspector.SidebarPane.prototype + } } + +WebInspector.PropertiesSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/RequestCookiesView.js b/Source/WebCore/inspector/front-end/RequestCookiesView.js index e21e61996..d8d5da840 100644 --- a/Source/WebCore/inspector/front-end/RequestCookiesView.js +++ b/Source/WebCore/inspector/front-end/RequestCookiesView.js @@ -81,7 +81,7 @@ WebInspector.RequestCookiesView.prototype = { return; this._buildCookiesTable(); this._cookiesTable.updateWidths(); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.RequestCookiesView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/RequestHTMLView.js b/Source/WebCore/inspector/front-end/RequestHTMLView.js index 63facf378..817f81305 100644 --- a/Source/WebCore/inspector/front-end/RequestHTMLView.js +++ b/Source/WebCore/inspector/front-end/RequestHTMLView.js @@ -32,12 +32,10 @@ * @constructor * @extends {WebInspector.RequestView} * @param {WebInspector.NetworkRequest} request - * @param {string} dataURL */ -WebInspector.RequestHTMLView = function(request, dataURL) +WebInspector.RequestHTMLView = function(request) { WebInspector.RequestView.call(this, request); - this._dataURL = dataURL; this.element.addStyleClass("html"); } @@ -63,10 +61,11 @@ WebInspector.RequestHTMLView.prototype = { // is deleted when iframe is removed from its parent. this.element.removeChildren(); var iframe = document.createElement("iframe"); - iframe.setAttribute("sandbox", ""); // Forbid to run JavaScript and set unique origin. - iframe.setAttribute("src", this._dataURL); this.element.appendChild(iframe); - }, + iframe.setAttribute("sandbox", ""); // Forbid to run JavaScript and set unique origin. - __proto__: WebInspector.RequestView.prototype + iframe.contentDocument.body.innerHTML = this.request.content; + } } + +WebInspector.RequestHTMLView.prototype.__proto__ = WebInspector.RequestView.prototype; diff --git a/Source/WebCore/inspector/front-end/RequestHeadersView.js b/Source/WebCore/inspector/front-end/RequestHeadersView.js index 40badcb54..75cb0245f 100644 --- a/Source/WebCore/inspector/front-end/RequestHeadersView.js +++ b/Source/WebCore/inspector/front-end/RequestHeadersView.js @@ -160,11 +160,10 @@ WebInspector.RequestHeadersView.prototype = { _refreshQueryString: function() { - var queryString = this._request.queryString(); var queryParameters = this._request.queryParameters; this._queryStringTreeElement.hidden = !queryParameters; if (queryParameters) - this._refreshParams(WebInspector.UIString("Query String Parameters"), queryParameters, queryString, this._queryStringTreeElement); + this._refreshParms(WebInspector.UIString("Query String Parameters"), queryParameters, this._queryStringTreeElement); }, _refreshUrlFragment: function() @@ -199,75 +198,58 @@ WebInspector.RequestHeadersView.prototype = { var formParameters = this._request.formParameters; if (formParameters) { this._formDataTreeElement.hidden = false; - this._refreshParams(WebInspector.UIString("Form Data"), formParameters, formData, this._formDataTreeElement); + this._refreshParms(WebInspector.UIString("Form Data"), formParameters, this._formDataTreeElement); } else { this._requestPayloadTreeElement.hidden = false; - this._populateTreeElementWithSourceText(this._requestPayloadTreeElement, formData) + this._refreshRequestPayload(formData); } }, - _populateTreeElementWithSourceText: function(treeElement, sourceText) + _refreshRequestPayload: function(formData) { - treeElement.removeChildren(); + this._requestPayloadTreeElement.removeChildren(); - var sourceTreeElement = new TreeElement(null, null, false); - sourceTreeElement.selectable = false; - treeElement.appendChild(sourceTreeElement); + var title = document.createElement("div"); + title.className = "raw-form-data header-value source-code"; + title.textContent = formData; - var sourceTextElement = document.createElement("span"); - sourceTextElement.addStyleClass("header-value"); - sourceTextElement.addStyleClass("source-code"); - sourceTextElement.textContent = String(sourceText).trim(); - sourceTreeElement.listItemElement.appendChild(sourceTextElement); + var parmTreeElement = new TreeElement(title, null, false); + parmTreeElement.selectable = false; + this._requestPayloadTreeElement.appendChild(parmTreeElement); }, - _refreshParams: function(title, params, sourceText, paramsTreeElement) + _refreshParms: function(title, parms, parmsTreeElement) { - paramsTreeElement.removeChildren(); + parmsTreeElement.removeChildren(); - paramsTreeElement.listItemElement.removeChildren(); - paramsTreeElement.listItemElement.appendChild(document.createTextNode(title)); + parmsTreeElement.listItemElement.removeChildren(); + parmsTreeElement.listItemElement.appendChild(document.createTextNode(title)); var headerCount = document.createElement("span"); headerCount.addStyleClass("header-count"); - headerCount.textContent = WebInspector.UIString(" (%d)", params.length); - paramsTreeElement.listItemElement.appendChild(headerCount); - - function toggleViewSource() - { - paramsTreeElement._viewSource = !paramsTreeElement._viewSource; - this._refreshParams(title, params, sourceText, paramsTreeElement); - } - - var viewSourceToggleTitle = paramsTreeElement._viewSource ? WebInspector.UIString("view parsed") : WebInspector.UIString("view source"); - var viewSourceToggleButton = this._createToggleButton(viewSourceToggleTitle); - viewSourceToggleButton.addEventListener("click", toggleViewSource.bind(this)); - paramsTreeElement.listItemElement.appendChild(viewSourceToggleButton); - - if (paramsTreeElement._viewSource) { - this._populateTreeElementWithSourceText(paramsTreeElement, sourceText); - return; - } + headerCount.textContent = WebInspector.UIString(" (%d)", parms.length); + parmsTreeElement.listItemElement.appendChild(headerCount); var toggleTitle = this._decodeRequestParameters ? WebInspector.UIString("view URL encoded") : WebInspector.UIString("view decoded"); var toggleButton = this._createToggleButton(toggleTitle); - toggleButton.addEventListener("click", this._toggleURLDecoding.bind(this)); - paramsTreeElement.listItemElement.appendChild(toggleButton); + toggleButton.addEventListener("click", this._toggleURLdecoding.bind(this)); + parmsTreeElement.listItemElement.appendChild(toggleButton); + - for (var i = 0; i < params.length; ++i) { + for (var i = 0; i < parms.length; ++i) { var paramNameValue = document.createDocumentFragment(); - var name = this._formatParameter(params[i].name + ":", "header-name", this._decodeRequestParameters); - var value = this._formatParameter(params[i].value, "header-value source-code", this._decodeRequestParameters); + var name = this._formatParameter(parms[i].name + ":", "header-name", this._decodeRequestParameters); + var value = this._formatParameter(parms[i].value, "header-value source-code", this._decodeRequestParameters); paramNameValue.appendChild(name); paramNameValue.appendChild(value); var parmTreeElement = new TreeElement(paramNameValue, null, false); parmTreeElement.selectable = false; - paramsTreeElement.appendChild(parmTreeElement); + parmsTreeElement.appendChild(parmTreeElement); } }, - _toggleURLDecoding: function(event) + _toggleURLdecoding: function(event) { this._decodeRequestParameters = !this._decodeRequestParameters; this._refreshQueryString(); @@ -387,8 +369,18 @@ WebInspector.RequestHeadersView.prototype = { _refreshHeadersText: function(title, headers, headersText, headersTreeElement) { - this._populateTreeElementWithSourceText(headersTreeElement, headersText); + headersTreeElement.removeChildren(); + this._refreshHeadersTitle(title, headersTreeElement, headers.length); + var headerTreeElement = new TreeElement(null, null, false); + headerTreeElement.selectable = false; + headersTreeElement.appendChild(headerTreeElement); + + var headersTextElement = document.createElement("span"); + headersTextElement.addStyleClass("header-value"); + headersTextElement.addStyleClass("source-code"); + headersTextElement.textContent = String(headersText).trim(); + headerTreeElement.listItemElement.appendChild(headersTextElement); }, _toggleRequestHeadersText: function(event) @@ -415,7 +407,7 @@ WebInspector.RequestHeadersView.prototype = { { var toggleTitle = isHeadersTextShown ? WebInspector.UIString("view parsed") : WebInspector.UIString("view source"); return this._createToggleButton(toggleTitle); - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.RequestHeadersView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/RequestJSONView.js b/Source/WebCore/inspector/front-end/RequestJSONView.js index 56d5c5bc1..436acb4b8 100644 --- a/Source/WebCore/inspector/front-end/RequestJSONView.js +++ b/Source/WebCore/inspector/front-end/RequestJSONView.js @@ -100,11 +100,11 @@ WebInspector.RequestJSONView.prototype = { section.expand(); section.editable = false; this.element.appendChild(section.element); - }, - - __proto__: WebInspector.RequestView.prototype + } } +WebInspector.RequestJSONView.prototype.__proto__ = WebInspector.RequestView.prototype; + /** * @constructor */ diff --git a/Source/WebCore/inspector/front-end/RequestPreviewView.js b/Source/WebCore/inspector/front-end/RequestPreviewView.js index 64581e532..4bf3a24d4 100644 --- a/Source/WebCore/inspector/front-end/RequestPreviewView.js +++ b/Source/WebCore/inspector/front-end/RequestPreviewView.js @@ -68,13 +68,8 @@ WebInspector.RequestPreviewView.prototype = { _createPreviewView: function() { - if (this.request.content) { - if (this.request.hasErrorStatusCode() || (this.request.type === WebInspector.resourceTypes.XHR && this.request.mimeType === "text/html")) { - var dataURL = this.request.asDataURL(); - if (dataURL !== null) - return new WebInspector.RequestHTMLView(this.request, dataURL); - } - } + if (this.request.hasErrorStatusCode() && this.request.content) + return new WebInspector.RequestHTMLView(this.request); if (this.request.type === WebInspector.resourceTypes.XHR && this.request.content) { var parsedJSON = WebInspector.RequestJSONView.parseJSON(this.request.content); @@ -95,7 +90,7 @@ WebInspector.RequestPreviewView.prototype = { return this._createEmptyView(); return WebInspector.RequestView.nonSourceViewForRequest(this.request); - }, - - __proto__: WebInspector.RequestContentView.prototype + } } + +WebInspector.RequestPreviewView.prototype.__proto__ = WebInspector.RequestContentView.prototype; diff --git a/Source/WebCore/inspector/front-end/RequestResponseView.js b/Source/WebCore/inspector/front-end/RequestResponseView.js index 284bae910..54977cf50 100644 --- a/Source/WebCore/inspector/front-end/RequestResponseView.js +++ b/Source/WebCore/inspector/front-end/RequestResponseView.js @@ -63,7 +63,7 @@ WebInspector.RequestResponseView.prototype = { this.sourceView.show(this.element); this.innerView = this.sourceView; } - }, - - __proto__: WebInspector.RequestContentView.prototype + } } + +WebInspector.RequestResponseView.prototype.__proto__ = WebInspector.RequestContentView.prototype; diff --git a/Source/WebCore/inspector/front-end/RequestTimingView.js b/Source/WebCore/inspector/front-end/RequestTimingView.js index 663e85a4c..824008854 100644 --- a/Source/WebCore/inspector/front-end/RequestTimingView.js +++ b/Source/WebCore/inspector/front-end/RequestTimingView.js @@ -70,12 +70,9 @@ WebInspector.RequestTimingView.prototype = { this._tableElement = WebInspector.RequestTimingView.createTimingTable(this._request); this.element.appendChild(this._tableElement); - }, - - __proto__: WebInspector.View.prototype + } } - WebInspector.RequestTimingView.createTimingTable = function(request) { var tableElement = document.createElement("table"); @@ -160,3 +157,5 @@ WebInspector.RequestTimingView.createTimingTable = function(request) } return tableElement; } + +WebInspector.RequestTimingView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/RequestView.js b/Source/WebCore/inspector/front-end/RequestView.js index 359e3ebd1..5c2164147 100644 --- a/Source/WebCore/inspector/front-end/RequestView.js +++ b/Source/WebCore/inspector/front-end/RequestView.js @@ -46,11 +46,11 @@ WebInspector.RequestView.prototype = { hasContent: function() { return false; - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.RequestView.prototype.__proto__ = WebInspector.View.prototype; + /** * @param {WebInspector.NetworkRequest} request */ diff --git a/Source/WebCore/inspector/front-end/Resource.js b/Source/WebCore/inspector/front-end/Resource.js index 4b2b3993e..83c5a5fb8 100644 --- a/Source/WebCore/inspector/front-end/Resource.js +++ b/Source/WebCore/inspector/front-end/Resource.js @@ -211,7 +211,7 @@ WebInspector.Resource.prototype = { }, /** - * @return {string} + * @return {?string} */ contentURL: function() { @@ -276,15 +276,26 @@ WebInspector.Resource.prototype = { { function onResourceContent() { - var imageSrc = WebInspector.contentAsDataURL(this._content, this.mimeType, this._contentEncoded); - if (imageSrc === null) - imageSrc = this.url; - image.src = imageSrc; + image.src = this._contentURL(); } this.requestContent(onResourceContent.bind(this)); }, + /** + * @return {string} + */ + _contentURL: function() + { + const maxDataUrlSize = 1024 * 1024; + // If resource content is not available or won't fit a data URL, fall back to using original URL. + if (this._content == null || this._content.length > maxDataUrlSize) + return this.url; + + return "data:" + this.mimeType + (this._contentEncoded ? ";base64," : ",") + this._content; + }, + + _requestFinished: function() { this._request.removeEventListener(WebInspector.NetworkRequest.Events.FinishedLoading, this._requestFinished, this); @@ -349,8 +360,8 @@ WebInspector.Resource.prototype = { isHidden: function() { return !!this._isHidden; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.Resource.prototype.__proto__ = WebInspector.Object.prototype; + diff --git a/Source/WebCore/inspector/front-end/ResourceScriptMapping.js b/Source/WebCore/inspector/front-end/ResourceScriptMapping.js index a86a73dc5..6dfeb11ff 100644 --- a/Source/WebCore/inspector/front-end/ResourceScriptMapping.js +++ b/Source/WebCore/inspector/front-end/ResourceScriptMapping.js @@ -40,7 +40,11 @@ WebInspector.ResourceScriptMapping = function(workspace) this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); /** @type {Object.<string, WebInspector.UISourceCode>} */ - this._temporaryUISourceCodeForScriptId = {}; + this._uiSourceCodeForScriptId = {}; + this._scriptIdForUISourceCode = new Map(); + this._temporaryUISourceCodes = new Map(); + /** @type {Object.<string, number>} */ + this._nextDynamicScriptIndexForURL = {}; this._scripts = []; } @@ -53,41 +57,10 @@ WebInspector.ResourceScriptMapping.prototype = { { var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Location} */ rawLocation; var script = WebInspector.debuggerModel.scriptForId(debuggerModelLocation.scriptId); - var uiSourceCode = this._workspaceUISourceCodeForScript(script); - if (!uiSourceCode) - uiSourceCode = this._getOrCreateTemporaryUISourceCode(script); - else if (uiSourceCode.scriptFile() && uiSourceCode.scriptFile().hasDivergedFromVM()) { - var temporaryUISourceCode = this._getOrCreateTemporaryUISourceCode(script); - temporaryUISourceCode.divergedVersion = uiSourceCode; - uiSourceCode = temporaryUISourceCode; - } - console.assert(!!uiSourceCode); + var uiSourceCode = this._uiSourceCodeForScriptId[debuggerModelLocation.scriptId]; return new WebInspector.UILocation(uiSourceCode, debuggerModelLocation.lineNumber, debuggerModelLocation.columnNumber || 0); }, - _hasDivergedFromVMChanged: function(event) - { - var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; - var scripts = this._scriptsForUISourceCode(uiSourceCode); - if (!scripts.length) - return; - for (var i = 0; i < scripts.length; ++i) - scripts[i].setSourceMapping(this); - if (uiSourceCode.scriptFile() && !uiSourceCode.scriptFile().hasDivergedFromVM()) - this._deleteTemporaryUISourceCodeForScripts(scripts); - }, - - /** - * @param {WebInspector.Script} script - * @return {WebInspector.UISourceCode} - */ - _workspaceUISourceCodeForScript: function(script) - { - if (script.isAnonymousScript() || this._isDynamicScript(script)) - return null; - return this._workspace.uiSourceCodeForURL(script.sourceURL); - }, - /** * @param {WebInspector.UISourceCode} uiSourceCode * @param {number} lineNumber @@ -96,9 +69,9 @@ WebInspector.ResourceScriptMapping.prototype = { */ uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) { - var scripts = this._scriptsForUISourceCode(uiSourceCode); - console.assert(scripts.length); - return WebInspector.debuggerModel.createRawLocation(scripts[0], lineNumber, columnNumber); + var scriptId = this._scriptIdForUISourceCode.get(uiSourceCode); + var script = WebInspector.debuggerModel.scriptForId(scriptId); + return WebInspector.debuggerModel.createRawLocation(script, lineNumber, columnNumber); }, /** @@ -106,35 +79,20 @@ WebInspector.ResourceScriptMapping.prototype = { */ addScript: function(script) { - if (!script.isAnonymousScript()) + console.assert(!this._uiSourceCodeForScriptId[script.scriptId]); + + var isDynamicScript = false; + if (!script.isAnonymousScript()) { this._scripts.push(script); - script.setSourceMapping(this); - var uiSourceCode = this._workspaceUISourceCodeForScript(script); - if (uiSourceCode) { - this._bindUISourceCodeToScripts(uiSourceCode, [script]); - return; + var uiSourceCode = this._workspace.uiSourceCodeForURL(script.sourceURL); + isDynamicScript = !!uiSourceCode && uiSourceCode.contentType() === WebInspector.resourceTypes.Document && !script.isInlineScript(); + if (uiSourceCode && !isDynamicScript && !this._temporaryUISourceCodes.get(uiSourceCode)) + this._bindUISourceCodeToScripts(uiSourceCode, [script]); } + if (!this._uiSourceCodeForScriptId[script.scriptId]) + this._addOrReplaceTemporaryUISourceCode(script, isDynamicScript); - var scripts = script.isInlineScript() ? this._scriptsForSourceURL(script.sourceURL, true) : [script]; - if (this._deleteTemporaryUISourceCodeForScripts(scripts)) - uiSourceCode = this._getOrCreateTemporaryUISourceCode(script); - }, - - /** - * @param {Array.<WebInspector.Script>} scripts - * @return {boolean} - */ - _deleteTemporaryUISourceCodeForScripts: function(scripts) - { - var temporaryUISourceCode; - for (var i = 0; i < scripts.length; ++i) { - var script = scripts[i]; - temporaryUISourceCode = temporaryUISourceCode || this._temporaryUISourceCodeForScriptId[script.scriptId]; - delete this._temporaryUISourceCodeForScriptId[script.scriptId]; - } - if (temporaryUISourceCode) - this._workspace.project().removeTemporaryUISourceCode(temporaryUISourceCode); - return !!temporaryUISourceCode; + console.assert(this._uiSourceCodeForScriptId[script.scriptId]); }, /** @@ -144,27 +102,14 @@ WebInspector.ResourceScriptMapping.prototype = { _bindUISourceCodeToScripts: function(uiSourceCode, scripts) { console.assert(scripts.length); - for (var i = 0; i < scripts.length; ++i) + + for (var i = 0; i < scripts.length; ++i) { + this._uiSourceCodeForScriptId[scripts[i].scriptId] = uiSourceCode; scripts[i].setSourceMapping(this); + } uiSourceCode.isContentScript = scripts[0].isContentScript; uiSourceCode.setSourceMapping(this); - if (!uiSourceCode.isTemporary) { - var scriptFile = new WebInspector.ResourceScriptFile(uiSourceCode); - uiSourceCode.setScriptFile(scriptFile); - scriptFile.addEventListener(WebInspector.ScriptFile.Events.HasDivergedFromVMChanged, this._hasDivergedFromVMChanged, this); - } - }, - - /** - * @param {WebInspector.Script} script - * @return {boolean} - */ - _isDynamicScript: function(script) - { - if (script.isAnonymousScript() || script.isInlineScript()) - return false; - var inlineScriptsWithTheSameURL = this._scriptsForSourceURL(script.sourceURL, true); - return !!inlineScriptsWithTheSameURL.length; + this._scriptIdForUISourceCode.put(uiSourceCode, scripts[0].scriptId); }, /** @@ -184,45 +129,54 @@ WebInspector.ResourceScriptMapping.prototype = { /** * @param {WebInspector.Script} script - * @return {WebInspector.UISourceCode} + * @param {boolean} isDynamicScript */ - _getOrCreateTemporaryUISourceCode: function(script) + _addOrReplaceTemporaryUISourceCode: function(script, isDynamicScript) { - var temporaryUISourceCode = this._temporaryUISourceCodeForScriptId[script.scriptId]; - if (temporaryUISourceCode) - return temporaryUISourceCode; - var scripts = script.isInlineScript() ? this._scriptsForSourceURL(script.sourceURL, true) : [script]; + + var oldUISourceCode; + for (var i = 0; i < scripts.length; ++i) { + oldUISourceCode = this._uiSourceCodeForScriptId[scripts[i].scriptId]; + if (oldUISourceCode) + break; + } + console.assert(!oldUISourceCode || this._temporaryUISourceCodes.get(oldUISourceCode)); + var contentProvider = script.isInlineScript() ? new WebInspector.ConcatenatedScriptsContentProvider(scripts) : script; - var isDynamicScript = this._isDynamicScript(script); - var url = isDynamicScript ? "" : script.sourceURL; - temporaryUISourceCode = new WebInspector.JavaScriptSource(url, contentProvider, false); - temporaryUISourceCode.isTemporary = true; - for (var i = 0; i < scripts.length; ++i) - this._temporaryUISourceCodeForScriptId[scripts[i].scriptId] = temporaryUISourceCode; - this._bindUISourceCodeToScripts(temporaryUISourceCode, scripts); - this._workspace.project().addTemporaryUISourceCode(temporaryUISourceCode); - return temporaryUISourceCode; + var url = script.sourceURL; + if (isDynamicScript) { + var nextIndex = this._nextDynamicScriptIndexForURL[script.sourceURL] || 1; + url += " (" + nextIndex + ")"; + this._nextDynamicScriptIndexForURL[script.sourceURL] = nextIndex + 1; + } + var uiSourceCode = new WebInspector.JavaScriptSource(url, null, contentProvider, !script.isInlineScript()); + this._temporaryUISourceCodes.put(uiSourceCode, uiSourceCode); + this._bindUISourceCodeToScripts(uiSourceCode, scripts); + + if (!script.sourceURL) + return uiSourceCode; + + if (oldUISourceCode) + this._uiSourceCodeReplaced(oldUISourceCode, uiSourceCode); + else + this._workspace.project().addUISourceCode(uiSourceCode); + return uiSourceCode; }, _uiSourceCodeAddedToWorkspace: function(event) { var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; - console.assert(!!uiSourceCode.url); - - var scripts = this._scriptsForUISourceCode(uiSourceCode); - if (!scripts.length) + console.assert(!this._scriptIdForUISourceCode.get(uiSourceCode) || this._temporaryUISourceCodes.get(uiSourceCode)); + if (!uiSourceCode.url || this._temporaryUISourceCodes.get(uiSourceCode)) return; - - this._deleteTemporaryUISourceCodeForScripts(scripts); - this._bindUISourceCodeToScripts(uiSourceCode, scripts); + this._addUISourceCode(uiSourceCode); }, /** * @param {WebInspector.UISourceCode} uiSourceCode - * @return {Array.<WebInspector.Script>} */ - _scriptsForUISourceCode: function(uiSourceCode) + _addUISourceCode: function(uiSourceCode) { var isInlineScript; switch (uiSourceCode.contentType()) { @@ -233,123 +187,41 @@ WebInspector.ResourceScriptMapping.prototype = { isInlineScript = false; break; default: - return []; + return; } - return this._scriptsForSourceURL(uiSourceCode.url, isInlineScript); - }, - - _reset: function() - { - this._temporaryUISourceCodeForScriptId = {}; - this._scripts = []; - }, -} - -/** - * @interface - */ -WebInspector.ScriptFile = function() -{ -} - -WebInspector.ScriptFile.Events = { - HasDivergedFromVMChanged: "HasDivergedFromVMChanged", -} - -WebInspector.ScriptFile.prototype = { - /** - * @return {boolean} - */ - hasDivergedFromVM: function() { return false; }, - - /** - * @return {boolean} - */ - isDivergingFromVM: function() { return false; }, - - /** - * @param {string} eventType - * @param {function(WebInspector.Event)} listener - * @param {Object=} thisObject - */ - addEventListener: function(eventType, listener, thisObject) { }, - - /** - * @param {string} eventType - * @param {function(WebInspector.Event)} listener - * @param {Object=} thisObject - */ - removeEventListener: function(eventType, listener, thisObject) { } -} - -/** - * @constructor - * @implements {WebInspector.ScriptFile} - * @extends {WebInspector.Object} - * @param {WebInspector.UISourceCode} uiSourceCode - */ -WebInspector.ResourceScriptFile = function(uiSourceCode) -{ - WebInspector.ScriptFile.call(this); - this._uiSourceCode = uiSourceCode; -} + var scripts = this._scriptsForSourceURL(uiSourceCode.url, isInlineScript); + if (!scripts.length) + return; -WebInspector.ResourceScriptFile.prototype = { - /** - * @param {function(?string)} callback - */ - workingCopyCommitted: function(callback) - { - /** - * @param {?string} error - */ - function innerCallback(error) - { - if (error) - this._hasDivergedFromVM = true; - else - delete this._hasDivergedFromVM; - this.fireHasDivergedFromVMChanged(); + var oldUISourceCode = this._uiSourceCodeForScriptId[scripts[0].scriptId]; + this._bindUISourceCodeToScripts(uiSourceCode, scripts); - callback(error); + if (oldUISourceCode) { + console.assert(this._temporaryUISourceCodes.get(oldUISourceCode)); + this._uiSourceCodeReplaced(oldUISourceCode, uiSourceCode); } - var rawLocation = /** @type {WebInspector.DebuggerModel.Location} */ this._uiSourceCode.uiLocationToRawLocation(0, 0); - if (!rawLocation) { - callback(null); - return; - } - var script = WebInspector.debuggerModel.scriptForId(rawLocation.scriptId); - WebInspector.debuggerModel.setScriptSource(script.scriptId, this._uiSourceCode.workingCopy(), innerCallback.bind(this)); - }, - workingCopyChanged: function() - { - this.fireHasDivergedFromVMChanged(); - }, - - fireHasDivergedFromVMChanged: function() - { - this._isDivergingFromVM = true; - this.dispatchEventToListeners(WebInspector.ScriptFile.Events.HasDivergedFromVMChanged, this._uiSourceCode); - delete this._isDivergingFromVM; + console.assert(this._scriptIdForUISourceCode.get(uiSourceCode) && !this._temporaryUISourceCodes.get(uiSourceCode)); }, /** - * @return {boolean} + * @param {WebInspector.UISourceCode} oldUISourceCode + * @param {WebInspector.UISourceCode} uiSourceCode */ - hasDivergedFromVM: function() + _uiSourceCodeReplaced: function(oldUISourceCode, uiSourceCode) { - return this._uiSourceCode.isDirty() || this._hasDivergedFromVM; + this._temporaryUISourceCodes.remove(oldUISourceCode); + this._scriptIdForUISourceCode.remove(oldUISourceCode); + this._workspace.project().replaceUISourceCode(oldUISourceCode, uiSourceCode); }, - /** - * @return {boolean} - */ - isDivergingFromVM: function() + _reset: function() { - return this._isDivergingFromVM; + this._uiSourceCodeForScriptId = {}; + this._scriptIdForUISourceCode.clear(); + this._temporaryUISourceCodes.clear(); + this._nextDynamicScriptIndexForURL = {}; + this._scripts = []; }, - - __proto__: WebInspector.Object.prototype } diff --git a/Source/WebCore/inspector/front-end/ResourceTreeModel.js b/Source/WebCore/inspector/front-end/ResourceTreeModel.js index f5527915c..d503dae60 100644 --- a/Source/WebCore/inspector/front-end/ResourceTreeModel.js +++ b/Source/WebCore/inspector/front-end/ResourceTreeModel.js @@ -339,11 +339,11 @@ WebInspector.ResourceTreeModel.prototype = { _createResourceFromFramePayload: function(frame, url, type, mimeType) { return new WebInspector.Resource(null, url, frame.url, frame.id, frame.loaderId, type, mimeType); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.ResourceTreeModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {WebInspector.ResourceTreeModel} model diff --git a/Source/WebCore/inspector/front-end/ResourceUtils.js b/Source/WebCore/inspector/front-end/ResourceUtils.js index 87eabf540..5c3f49de6 100644 --- a/Source/WebCore/inspector/front-end/ResourceUtils.js +++ b/Source/WebCore/inspector/front-end/ResourceUtils.js @@ -226,18 +226,3 @@ WebInspector.linkifyRequestAsNode = function(request, classes) anchor.requestId = request.requestId; return anchor; } - -/** - * @param {string} content - * @param {string} mimeType - * @param {boolean} contentEncoded - * @return {?string} - */ -WebInspector.contentAsDataURL = function(content, mimeType, contentEncoded) -{ - const maxDataUrlSize = 1024 * 1024; - if (content == null || content.length > maxDataUrlSize) - return null; - - return "data:" + mimeType + (contentEncoded ? ";base64," : ",") + content; -} diff --git a/Source/WebCore/inspector/front-end/ResourceView.js b/Source/WebCore/inspector/front-end/ResourceView.js index e48e5ea64..ce50b4b6c 100644 --- a/Source/WebCore/inspector/front-end/ResourceView.js +++ b/Source/WebCore/inspector/front-end/ResourceView.js @@ -44,11 +44,11 @@ WebInspector.ResourceView.prototype = { hasContent: function() { return false; - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.ResourceView.prototype.__proto__ = WebInspector.View.prototype; + /** * @param {WebInspector.Resource} resource */ @@ -97,7 +97,7 @@ WebInspector.ResourceSourceFrame.prototype = { contextMenu.appendApplicableItems(this._resource); if (this._resource.request) contextMenu.appendApplicableItems(this._resource.request); - }, - - __proto__: WebInspector.SourceFrame.prototype + } } + +WebInspector.ResourceSourceFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype; diff --git a/Source/WebCore/inspector/front-end/ResourceWebSocketFrameView.js b/Source/WebCore/inspector/front-end/ResourceWebSocketFrameView.js index 9884828ba..59acd6518 100644 --- a/Source/WebCore/inspector/front-end/ResourceWebSocketFrameView.js +++ b/Source/WebCore/inspector/front-end/ResourceWebSocketFrameView.js @@ -95,6 +95,4 @@ WebInspector.ResourceWebSocketFrameView.OpCodes = { PongFrame: 10 }; -WebInspector.ResourceWebSocketFrameView.prototype = { - __proto__: WebInspector.View.prototype -} +WebInspector.ResourceWebSocketFrameView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js index c505c97e0..8ddcd2520 100644 --- a/Source/WebCore/inspector/front-end/ResourcesPanel.js +++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js @@ -854,11 +854,11 @@ WebInspector.ResourcesPanel.prototype = { this._previousHoveredElement.hovered = false; delete this._previousHoveredElement; } - }, - - __proto__: WebInspector.Panel.prototype + } } +WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.Panel.prototype; + /** * @constructor * @extends {TreeElement} @@ -982,11 +982,11 @@ WebInspector.BaseStorageTreeElement.prototype = { get searchMatchesCount() { return 0; - }, - - __proto__: TreeElement.prototype + } } +WebInspector.BaseStorageTreeElement.prototype.__proto__ = TreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1027,11 +1027,11 @@ WebInspector.StorageCategoryTreeElement.prototype = { oncollapse: function() { WebInspector.settings[this._expandedSettingKey].set(false); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1147,11 +1147,11 @@ WebInspector.FrameTreeElement.prototype = { break; } parentTreeElement.insertChild(childTreeElement, i); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.FrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1317,11 +1317,11 @@ WebInspector.FrameResourceTreeElement.prototype = { } } return this._sourceView; - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.FrameResourceTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1360,11 +1360,11 @@ WebInspector.DatabaseTreeElement.prototype = { this.appendChild(new WebInspector.DatabaseTableTreeElement(this._storagePanel, this._database, tableNames[i])); } this._database.getTableNames(tableNamesCallback.bind(this)); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.DatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1386,10 +1386,9 @@ WebInspector.DatabaseTableTreeElement.prototype = { { WebInspector.BaseStorageTreeElement.prototype.onselect.call(this); this._storagePanel._showDatabase(this._database, this._tableName); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.DatabaseTableTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; /** * @constructor @@ -1501,11 +1500,11 @@ WebInspector.IndexedDBTreeElement.prototype = { if (index !== -1) return this._idbDatabaseTreeElements[i]; return null; - }, - - __proto__: WebInspector.StorageCategoryTreeElement.prototype + } } +WebInspector.IndexedDBTreeElement.prototype.__proto__ = WebInspector.StorageCategoryTreeElement.prototype; + /** * @constructor * @extends {WebInspector.StorageCategoryTreeElement} @@ -1572,11 +1571,11 @@ WebInspector.FileSystemListTreeElement.prototype = { } this._fileSystemModel.refreshFileSystemList(); - }, - - __proto__: WebInspector.StorageCategoryTreeElement.prototype + } } +WebInspector.FileSystemListTreeElement.prototype.__proto__ = WebInspector.StorageCategoryTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1678,11 +1677,11 @@ WebInspector.IDBDatabaseTreeElement.prototype = { { for (var objectStoreName in this._idbObjectStoreTreeElements) this._objectStoreRemoved(objectStoreName); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.IDBDatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1781,11 +1780,11 @@ WebInspector.IDBObjectStoreTreeElement.prototype = { this._indexRemoved(indexName); if (this._view) this._view.clear(); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.IDBObjectStoreTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1848,11 +1847,11 @@ WebInspector.IDBIndexTreeElement.prototype = { { if (this._view) this._view.clear(); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.IDBIndexTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; + /** * @constructor * @extends {WebInspector.BaseStorageTreeElement} @@ -1873,10 +1872,9 @@ WebInspector.DOMStorageTreeElement.prototype = { { WebInspector.BaseStorageTreeElement.prototype.onselect.call(this); this._storagePanel._showDOMStorage(this._domStorage); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.DOMStorageTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; /** * @constructor @@ -1898,10 +1896,9 @@ WebInspector.CookieTreeElement.prototype = { { WebInspector.BaseStorageTreeElement.prototype.onselect.call(this); this._storagePanel.showCookies(this, this._cookieDomain); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.CookieTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; /** * @constructor @@ -1930,10 +1927,9 @@ WebInspector.ApplicationCacheManifestTreeElement.prototype = { { WebInspector.BaseStorageTreeElement.prototype.onselect.call(this); this._storagePanel.showCategoryView(this._manifestURL); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.ApplicationCacheManifestTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; /** * @constructor @@ -1983,10 +1979,9 @@ WebInspector.ApplicationCacheFrameTreeElement.prototype = { { WebInspector.BaseStorageTreeElement.prototype.onselect.call(this); this._storagePanel.showApplicationCache(this._frameId); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.ApplicationCacheFrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; /** * @constructor @@ -2023,11 +2018,11 @@ WebInspector.FileSystemTreeElement.prototype = { { if (this.fileSystemView && this._storagePanel.visibleView == this.fileSystemView) this._storagePanel.closeVisibleView(); - }, - - __proto__: WebInspector.BaseStorageTreeElement.prototype + } } +WebInspector.FileSystemTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; + /** * @constructor * @extends {WebInspector.View} @@ -2045,11 +2040,11 @@ WebInspector.StorageCategoryView.prototype = { setText: function(text) { this._emptyView.text = text; - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.StorageCategoryView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @param {WebInspector.BaseStorageTreeElement} rootElement diff --git a/Source/WebCore/inspector/front-end/RevisionHistoryView.js b/Source/WebCore/inspector/front-end/RevisionHistoryView.js index 56b822676..f80e498aa 100644 --- a/Source/WebCore/inspector/front-end/RevisionHistoryView.js +++ b/Source/WebCore/inspector/front-end/RevisionHistoryView.js @@ -55,8 +55,8 @@ WebInspector.RevisionHistoryView = function() WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this)); WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted, this._revisionAdded, this); + WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this); WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this); - WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeRemoved, this._uiSourceCodeRemoved, this); WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset, this); this._statusElement = document.createElement("span"); @@ -161,13 +161,22 @@ WebInspector.RevisionHistoryView.prototype = { }, /** + * @param {WebInspector.Event} event + */ + _uiSourceCodeReplaced: function(event) + { + var oldUISourceCode = /** @type {WebInspector.UISourceCode} */ event.data.oldUISourceCode; + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode; + this._removeUISourceCode(oldUISourceCode); + this._revealUISourceCode(uiSourceCode); + }, + + /** * @param {WebInspector.UISourceCode} uiSourceCode */ _removeUISourceCode: function(uiSourceCode) { var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode); - if (!uiSourceCodeItem) - return; this._treeOutline.removeChild(uiSourceCodeItem); this._uiSourceCodeItems.remove(uiSourceCode); }, @@ -176,11 +185,11 @@ WebInspector.RevisionHistoryView.prototype = { { this._treeOutline.removeChildren(); this._uiSourceCodeItems.clear(); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.RevisionHistoryView.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {TreeElement} @@ -313,7 +322,7 @@ WebInspector.RevisionHistoryTreeElement.prototype = { allowRevert: function() { this._revertElement.removeStyleClass("hidden"); - }, - - __proto__: TreeElement.prototype + } } + +WebInspector.RevisionHistoryTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/Source/WebCore/inspector/front-end/RuntimeModel.js b/Source/WebCore/inspector/front-end/RuntimeModel.js index 6f7f9e39e..f56335622 100644 --- a/Source/WebCore/inspector/front-end/RuntimeModel.js +++ b/Source/WebCore/inspector/front-end/RuntimeModel.js @@ -49,22 +49,6 @@ WebInspector.RuntimeModel.Events = { WebInspector.RuntimeModel.prototype = { /** - * @param {WebInspector.ExecutionContext} executionContext - */ - setCurrentExecutionContext: function(executionContext) - { - this._currentExecutionContext = executionContext; - }, - - /** - * @return {WebInspector.ExecutionContext} - */ - currentExecutionContext: function() - { - return this._currentExecutionContext; - }, - - /** * @return {Array.<WebInspector.FrameExecutionContextList>} */ contextLists: function() @@ -111,7 +95,7 @@ WebInspector.RuntimeModel.prototype = { _didLoadCachedResources: function() { InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(this)); - RuntimeAgent.enable(); + RuntimeAgent.setReportExecutionContextCreation(true); }, _executionContextCreated: function(context) @@ -121,209 +105,11 @@ WebInspector.RuntimeModel.prototype = { if (!contextList) return; contextList._addExecutionContext(new WebInspector.ExecutionContext(context.id, context.name, context.isPageContext)); - }, - - /** - * @param {string} expression - * @param {string} objectGroup - * @param {boolean} includeCommandLineAPI - * @param {boolean} doNotPauseOnExceptionsAndMuteConsole - * @param {boolean} returnByValue - * @param {function(?WebInspector.RemoteObject, boolean, RuntimeAgent.RemoteObject=)} callback - */ - evaluate: function(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, callback) - { - if (WebInspector.debuggerModel.selectedCallFrame()) { - WebInspector.debuggerModel.evaluateOnSelectedCallFrame(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, callback); - return; - } - - if (!expression) { - // There is no expression, so the completion should happen against global properties. - expression = "this"; - } - - /** - * @param {?Protocol.Error} error - * @param {RuntimeAgent.RemoteObject} result - * @param {boolean=} wasThrown - */ - function evalCallback(error, result, wasThrown) - { - if (error) { - console.error(error); - callback(null, false); - return; - } - - if (returnByValue) - callback(null, !!wasThrown, wasThrown ? null : result); - else - callback(WebInspector.RemoteObject.fromPayload(result), !!wasThrown); - } - RuntimeAgent.evaluate(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, this._currentExecutionContext ? this._currentExecutionContext.id : undefined, returnByValue, evalCallback); - }, - - /** - * @param {Element} proxyElement - * @param {Range} wordRange - * @param {boolean} force - * @param {function(Array.<string>, number=)} completionsReadyCallback - */ - completionsForTextPrompt: function(proxyElement, wordRange, force, completionsReadyCallback) - { - // Pass less stop characters to rangeOfWord so the range will be a more complete expression. - var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOffset, " =:[({;,!+-*/&|^<>", proxyElement, "backward"); - var expressionString = expressionRange.toString(); - var prefix = wordRange.toString(); - this._completionsForExpression(expressionString, prefix, force, completionsReadyCallback); - }, - - /** - * @param {string} expressionString - * @param {string} prefix - * @param {boolean} force - * @param {function(Array.<string>, number=)} completionsReadyCallback - */ - _completionsForExpression: function(expressionString, prefix, force, completionsReadyCallback) - { - var lastIndex = expressionString.length - 1; - - var dotNotation = (expressionString[lastIndex] === "."); - var bracketNotation = (expressionString[lastIndex] === "["); - - if (dotNotation || bracketNotation) - expressionString = expressionString.substr(0, lastIndex); - - if (expressionString && parseInt(expressionString, 10) == expressionString) { - // User is entering float value, do not suggest anything. - completionsReadyCallback([]); - return; - } - - if (!prefix && !expressionString && !force) { - completionsReadyCallback([]); - return; - } - - if (!expressionString && WebInspector.debuggerModel.selectedCallFrame()) - WebInspector.debuggerModel.getSelectedCallFrameVariables(receivedPropertyNames.bind(this)); - else - this.evaluate(expressionString, "completion", true, true, false, evaluated.bind(this)); - - function evaluated(result, wasThrown) - { - if (!result || wasThrown) { - completionsReadyCallback([]); - return; - } - - function getCompletions(primitiveType) - { - var object; - if (primitiveType === "string") - object = new String(""); - else if (primitiveType === "number") - object = new Number(0); - else if (primitiveType === "boolean") - object = new Boolean(false); - else - object = this; - - var resultSet = {}; - for (var o = object; o; o = o.__proto__) { - try { - var names = Object.getOwnPropertyNames(o); - for (var i = 0; i < names.length; ++i) - resultSet[names[i]] = true; - } catch (e) { - } - } - return resultSet; - } - - if (result.type === "object" || result.type === "function") - result.callFunctionJSON(getCompletions, undefined, receivedPropertyNames.bind(this)); - else if (result.type === "string" || result.type === "number" || result.type === "boolean") - this.evaluate("(" + getCompletions + ")(\"" + result.type + "\")", "completion", false, true, true, receivedPropertyNamesFromEval.bind(this)); - } - - function receivedPropertyNamesFromEval(notRelevant, wasThrown, result) - { - if (result && !wasThrown) - receivedPropertyNames.call(this, result.value); - else - completionsReadyCallback([]); - } - - function receivedPropertyNames(propertyNames) - { - RuntimeAgent.releaseObjectGroup("completion"); - if (!propertyNames) { - completionsReadyCallback([]); - return; - } - var includeCommandLineAPI = (!dotNotation && !bracketNotation); - if (includeCommandLineAPI) { - const commandLineAPI = ["dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear"]; - for (var i = 0; i < commandLineAPI.length; ++i) - propertyNames[commandLineAPI[i]] = true; - } - this._reportCompletions(completionsReadyCallback, dotNotation, bracketNotation, expressionString, prefix, Object.keys(propertyNames)); - } - }, - - /** - * @param {function(Array.<string>, number=)} completionsReadyCallback - * @param {boolean} dotNotation - * @param {boolean} bracketNotation - * @param {string} expressionString - * @param {string} prefix - * @param {Array.<string>} properties - */ - _reportCompletions: function(completionsReadyCallback, dotNotation, bracketNotation, expressionString, prefix, properties) { - if (bracketNotation) { - if (prefix.length && prefix[0] === "'") - var quoteUsed = "'"; - else - var quoteUsed = "\""; - } - - var results = []; - - if (!expressionString) { - const keywords = ["break", "case", "catch", "continue", "default", "delete", "do", "else", "finally", "for", "function", "if", "in", - "instanceof", "new", "return", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with"]; - properties = properties.concat(keywords); - } - - properties.sort(); - - for (var i = 0; i < properties.length; ++i) { - var property = properties[i]; - - if (dotNotation && !/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(property)) - continue; - - if (bracketNotation) { - if (!/^[0-9]+$/.test(property)) - property = quoteUsed + property.escapeCharacters(quoteUsed + "\\") + quoteUsed; - property += "]"; - } - - if (property.length < prefix.length) - continue; - if (prefix.length && !property.startsWith(prefix)) - continue; - - results.push(property); - } - completionsReadyCallback(results); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.RuntimeModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @type {WebInspector.RuntimeModel} */ @@ -445,7 +231,7 @@ WebInspector.FrameExecutionContextList.prototype = return name + "( " + subtitle + " )"; } return "<iframe>"; - }, - - __proto__: WebInspector.Object.prototype + } } + +WebInspector.FrameExecutionContextList.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/SASSSourceMapping.js b/Source/WebCore/inspector/front-end/SASSSourceMapping.js index 9c7cab4e7..0b8e96e6e 100644 --- a/Source/WebCore/inspector/front-end/SASSSourceMapping.js +++ b/Source/WebCore/inspector/front-end/SASSSourceMapping.js @@ -114,9 +114,7 @@ WebInspector.SASSSourceMapping.prototype = { { var uiSourceCode = this._uiSourceCodeForURL[url]; if (!uiSourceCode) { - var content = InspectorFrontendHost.loadResourceSynchronously(url); - var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content, "text/x-scss"); - uiSourceCode = new WebInspector.UISourceCode(url, contentProvider, true); + uiSourceCode = new WebInspector.SASSSource(url); this._uiSourceCodeForURL[url] = uiSourceCode; this._workspace.project().addUISourceCode(uiSourceCode); WebInspector.cssModel.setSourceMapping(rawURL, this); @@ -160,3 +158,26 @@ WebInspector.SASSSourceMapping.prototype = { } } +/** + * @constructor + * @extends {WebInspector.UISourceCode} + * @param {string} sassURL + */ +WebInspector.SASSSource = function(sassURL) +{ + var content = InspectorFrontendHost.loadResourceSynchronously(sassURL); + var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content, "text/x-scss"); + WebInspector.UISourceCode.call(this, sassURL, null, contentProvider); +} + +WebInspector.SASSSource.prototype = { + /** + * @return {boolean} + */ + isEditable: function() + { + return true; + } +} + +WebInspector.SASSSource.prototype.__proto__ = WebInspector.UISourceCode.prototype; diff --git a/Source/WebCore/inspector/front-end/ScopeChainSidebarPane.js b/Source/WebCore/inspector/front-end/ScopeChainSidebarPane.js index 46bee9076..56de87005 100644 --- a/Source/WebCore/inspector/front-end/ScopeChainSidebarPane.js +++ b/Source/WebCore/inspector/front-end/ScopeChainSidebarPane.js @@ -112,19 +112,17 @@ WebInspector.ScopeChainSidebarPane.prototype = { section.editInSelectedCallFrameWhenPaused = true; section.pane = this; - if (scope.type === "global") - section.expanded = false; - else if (!foundLocalScope || scope.type === "local" || title in this._expandedSections) + if (!foundLocalScope || scope.type === "local" || title in this._expandedSections) section.expanded = true; this._sections.push(section); this.bodyElement.appendChild(section.element); } - }, - - __proto__: WebInspector.SidebarPane.prototype + } } +WebInspector.ScopeChainSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + /** * @constructor * @extends {WebInspector.ObjectPropertyTreeElement} @@ -182,7 +180,7 @@ WebInspector.ScopeVariableTreeElement.prototype = { this._propertyPath = result; return result; - }, - - __proto__: WebInspector.ObjectPropertyTreeElement.prototype + } } + +WebInspector.ScopeVariableTreeElement.prototype.__proto__ = WebInspector.ObjectPropertyTreeElement.prototype; diff --git a/Source/WebCore/inspector/front-end/Script.js b/Source/WebCore/inspector/front-end/Script.js index aaf387aa7..920ac2675 100644 --- a/Source/WebCore/inspector/front-end/Script.js +++ b/Source/WebCore/inspector/front-end/Script.js @@ -34,9 +34,8 @@ * @param {number} endColumn * @param {boolean} isContentScript * @param {string=} sourceMapURL - * @param {boolean=} hasSourceURL */ -WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL) +WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL) { this.scriptId = scriptId; this.sourceURL = sourceURL; @@ -46,13 +45,12 @@ WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endL this.endColumn = endColumn; this.isContentScript = isContentScript; this.sourceMapURL = sourceMapURL; - this.hasSourceURL = hasSourceURL; this._locations = []; } WebInspector.Script.prototype = { /** - * @return {string} + * @return {?string} */ contentURL: function() { @@ -232,7 +230,7 @@ WebInspector.Script.Location.prototype = { { WebInspector.LiveLocation.prototype.dispose.call(this); this._script._locations.remove(this); - }, - - __proto__: WebInspector.LiveLocation.prototype + } } + +WebInspector.Script.Location.prototype.__proto__ = WebInspector.LiveLocation.prototype; diff --git a/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js b/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js index d394a2ad2..13c7a0e75 100644 --- a/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js +++ b/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js @@ -218,11 +218,11 @@ HTMLScriptFormatter.prototype = { styleSheetEnded: function(cursor) { - }, - - __proto__: WebInspector.SourceHTMLTokenizer.prototype + } } +HTMLScriptFormatter.prototype.__proto__ = WebInspector.SourceHTMLTokenizer.prototype; + function require() { return parse; diff --git a/Source/WebCore/inspector/front-end/ScriptSnippetModel.js b/Source/WebCore/inspector/front-end/ScriptSnippetModel.js index 33535ff9a..60a667233 100644 --- a/Source/WebCore/inspector/front-end/ScriptSnippetModel.js +++ b/Source/WebCore/inspector/front-end/ScriptSnippetModel.js @@ -39,7 +39,6 @@ WebInspector.ScriptSnippetModel = function(workspace) this._uiSourceCodeForScriptId = {}; this._scriptForUISourceCode = new Map(); this._snippetJavaScriptSourceForSnippetId = {}; - this._snippetIdForJavaScriptSource = new Map(); this._snippetStorage = new WebInspector.SnippetStorage("script", "Script snippet #"); this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSetting("lastSnippetEvaluationIndex", 0); @@ -82,10 +81,7 @@ WebInspector.ScriptSnippetModel.prototype = { */ _addScriptSnippet: function(snippet) { - var snippetJavaScriptSource = new WebInspector.SnippetJavaScriptSource(snippet.name, new WebInspector.SnippetContentProvider(snippet), this); - var scriptFile = new WebInspector.SnippetScriptFile(this, snippetJavaScriptSource); - snippetJavaScriptSource.setScriptFile(scriptFile); - this._snippetIdForJavaScriptSource.put(snippetJavaScriptSource, snippet.id); + var snippetJavaScriptSource = new WebInspector.SnippetJavaScriptSource(snippet.id, snippet.name, new WebInspector.SnippetContentProvider(snippet), this); snippetJavaScriptSource.setSourceMapping(this._snippetScriptMapping); this._snippetJavaScriptSourceForSnippetId[snippet.id] = snippetJavaScriptSource; this._workspace.project().addUISourceCode(snippetJavaScriptSource); @@ -97,13 +93,11 @@ WebInspector.ScriptSnippetModel.prototype = { */ deleteScriptSnippet: function(snippetJavaScriptSource) { - var snippetId = this._snippetIdForJavaScriptSource.get(snippetJavaScriptSource); - var snippet = this._snippetStorage.snippetForId(snippetId); + var snippet = this._snippetStorage.snippetForId(snippetJavaScriptSource.snippetId); this._snippetStorage.deleteSnippet(snippet); this._removeBreakpoints(snippetJavaScriptSource); this._releaseSnippetScript(snippetJavaScriptSource); delete this._snippetJavaScriptSourceForSnippetId[snippet.id]; - this._snippetIdForJavaScriptSource.remove(snippetJavaScriptSource); this._workspace.project().removeUISourceCode(snippetJavaScriptSource); }, @@ -113,14 +107,21 @@ WebInspector.ScriptSnippetModel.prototype = { */ renameScriptSnippet: function(snippetJavaScriptSource, newName) { - var breakpointLocations = this._removeBreakpoints(snippetJavaScriptSource); - var snippetId = this._snippetIdForJavaScriptSource.get(snippetJavaScriptSource); - var snippet = this._snippetStorage.snippetForId(snippetId); + var snippet = this._snippetStorage.snippetForId(snippetJavaScriptSource.snippetId); if (!snippet || !newName || snippet.name === newName) return; snippet.name = newName; snippetJavaScriptSource.urlChanged(snippet.name); - this._restoreBreakpoints(snippetJavaScriptSource, breakpointLocations); + }, + + /** + * @param {WebInspector.SnippetJavaScriptSource} snippetJavaScriptSource + * @return {boolean} + */ + _isDivergedFromVM: function(snippetJavaScriptSource) + { + var script = this._scriptForUISourceCode.get(snippetJavaScriptSource); + return !script; }, /** @@ -129,8 +130,7 @@ WebInspector.ScriptSnippetModel.prototype = { */ _setScriptSnippetContent: function(snippetJavaScriptSource, newContent) { - var snippetId = this._snippetIdForJavaScriptSource.get(snippetJavaScriptSource); - var snippet = this._snippetStorage.snippetForId(snippetId); + var snippet = this._snippetStorage.snippetForId(snippetJavaScriptSource.snippetId); snippet.content = newContent; }, @@ -144,10 +144,8 @@ WebInspector.ScriptSnippetModel.prototype = { return; var breakpointLocations = this._removeBreakpoints(snippetJavaScriptSource); - var uiSourceCode = this._releaseSnippetScript(snippetJavaScriptSource); + this._releaseSnippetScript(snippetJavaScriptSource); this._restoreBreakpoints(snippetJavaScriptSource, breakpointLocations); - if (uiSourceCode) - this._restoreBreakpoints(uiSourceCode, breakpointLocations); }, /** @@ -169,8 +167,7 @@ WebInspector.ScriptSnippetModel.prototype = { var breakpointLocations = this._removeBreakpoints(snippetJavaScriptSource); this._releaseSnippetScript(snippetJavaScriptSource); this._restoreBreakpoints(snippetJavaScriptSource, breakpointLocations); - var snippetId = this._snippetIdForJavaScriptSource.get(snippetJavaScriptSource); - var evaluationIndex = this._nextEvaluationIndex(snippetId); + var evaluationIndex = this._nextEvaluationIndex(snippetJavaScriptSource.snippetId); snippetJavaScriptSource._evaluationIndex = evaluationIndex; var evaluationUrl = this._evaluationSourceURL(snippetJavaScriptSource); @@ -216,46 +213,11 @@ WebInspector.ScriptSnippetModel.prototype = { var breakpointLocations = this._removeBreakpoints(snippetJavaScriptSource); this._restoreBreakpoints(snippetJavaScriptSource, breakpointLocations); - this._runScript(scriptId); - } - }, - - /** - * @param {DebuggerAgent.ScriptId} scriptId - */ - _runScript: function(scriptId) - { - var currentExecutionContext = WebInspector.runtimeModel.currentExecutionContext(); - DebuggerAgent.runScript(scriptId, currentExecutionContext ? currentExecutionContext.id : undefined, "console", false, runCallback.bind(this)); - - /** - * @param {?string} error - * @param {?RuntimeAgent.RemoteObject} result - * @param {boolean=} wasThrown - */ - function runCallback(error, result, wasThrown) - { - if (error) { - console.error(error); - return; - } - - this._printRunScriptResult(result, wasThrown); + WebInspector.consoleView.runScript(scriptId); } }, /** - * @param {?RuntimeAgent.RemoteObject} result - * @param {boolean=} wasThrown - */ - _printRunScriptResult: function(result, wasThrown) - { - var level = (wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log); - var message = WebInspector.ConsoleMessage.create(WebInspector.ConsoleMessage.MessageSource.JS, level, "", undefined, undefined, undefined, undefined, [result]); - WebInspector.console.addMessage(message) - }, - - /** * @param {WebInspector.DebuggerModel.Location} rawLocation * @return {WebInspector.UILocation} */ @@ -310,25 +272,20 @@ WebInspector.ScriptSnippetModel.prototype = { console.assert(!this._scriptForUISourceCode.get(snippetJavaScriptSource)); this._uiSourceCodeForScriptId[script.scriptId] = snippetJavaScriptSource; this._scriptForUISourceCode.put(snippetJavaScriptSource, script); - snippetJavaScriptSource.scriptFile().setHasDivergedFromVM(false); script.setSourceMapping(this._snippetScriptMapping); }, /** * @param {WebInspector.Script} script - * @return {WebInspector.UISourceCode} uiSourceCode */ _createUISourceCodeForScript: function(script) { - var uiSourceCode = new WebInspector.JavaScriptSource(script.sourceURL, script, false); - uiSourceCode.setSourceMapping(this._snippetScriptMapping); - // FIXME: Should be added to workspace as temporary. - uiSourceCode.isTemporary = true; + var uiSourceCode = new WebInspector.JavaScriptSource(script.sourceURL, null, script, false); + uiSourceCode.setSourceMapping(this._snippetScriptMapping); uiSourceCode.isSnippetEvaluation = true; this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode; this._scriptForUISourceCode.put(uiSourceCode, script); script.setSourceMapping(this._snippetScriptMapping); - return uiSourceCode; }, /** @@ -344,36 +301,31 @@ WebInspector.ScriptSnippetModel.prototype = { }, /** - * @param {WebInspector.UISourceCode} uiSourceCode + * @param {WebInspector.SnippetJavaScriptSource} snippetJavaScriptSource * @param {Array.<Object>} breakpointLocations */ - _restoreBreakpoints: function(uiSourceCode, breakpointLocations) + _restoreBreakpoints: function(snippetJavaScriptSource, breakpointLocations) { for (var i = 0; i < breakpointLocations.length; ++i) { var uiLocation = breakpointLocations[i].uiLocation; var breakpoint = breakpointLocations[i].breakpoint; - WebInspector.breakpointManager.setBreakpoint(uiSourceCode, uiLocation.lineNumber, breakpoint.condition(), breakpoint.enabled()); + WebInspector.breakpointManager.setBreakpoint(uiLocation.uiSourceCode, uiLocation.lineNumber, breakpoint.condition(), breakpoint.enabled()); } }, /** * @param {WebInspector.SnippetJavaScriptSource} snippetJavaScriptSource - * @return {WebInspector.UISourceCode} */ _releaseSnippetScript: function(snippetJavaScriptSource) { var script = this._scriptForUISourceCode.get(snippetJavaScriptSource); if (!script) - return null; + return; - snippetJavaScriptSource.scriptFile().setIsDivergingFromVM(true); - snippetJavaScriptSource.scriptFile().setHasDivergedFromVM(true); delete this._uiSourceCodeForScriptId[script.scriptId]; this._scriptForUISourceCode.remove(snippetJavaScriptSource); delete snippetJavaScriptSource._evaluationIndex; - var uiSourceCode = this._createUISourceCodeForScript(script); - snippetJavaScriptSource.scriptFile().setIsDivergingFromVM(false); - return uiSourceCode; + this._createUISourceCodeForScript(script); }, /** @@ -384,8 +336,7 @@ WebInspector.ScriptSnippetModel.prototype = { { var snippetPrefix = WebInspector.ScriptSnippetModel.snippetSourceURLPrefix; var evaluationSuffix = "_" + snippetJavaScriptSource._evaluationIndex; - var snippetId = this._snippetIdForJavaScriptSource.get(snippetJavaScriptSource); - return snippetPrefix + snippetId + evaluationSuffix; + return snippetPrefix + snippetJavaScriptSource.snippetId + evaluationSuffix; }, /** @@ -408,100 +359,95 @@ WebInspector.ScriptSnippetModel.prototype = { this._uiSourceCodeForScriptId = {}; this._scriptForUISourceCode = new Map(); this._snippetJavaScriptSourceForSnippetId = {}; - this._snippetIdForJavaScriptSource = new Map(); }, _projectDidReset: function() { this._loadSnippets(); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.ScriptSnippetModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @extends {WebInspector.JavaScriptSource} + * @param {string} snippetId * @param {string} snippetName * @param {WebInspector.ContentProvider} contentProvider * @param {WebInspector.ScriptSnippetModel} scriptSnippetModel */ -WebInspector.SnippetJavaScriptSource = function(snippetName, contentProvider, scriptSnippetModel) +WebInspector.SnippetJavaScriptSource = function(snippetId, snippetName, contentProvider, scriptSnippetModel) { - WebInspector.JavaScriptSource.call(this, snippetName, contentProvider, true); + WebInspector.JavaScriptSource.call(this, snippetName, null, contentProvider, true); + this._snippetId = snippetId; this._scriptSnippetModel = scriptSnippetModel; this.isSnippet = true; } WebInspector.SnippetJavaScriptSource.prototype = { - __proto__: WebInspector.JavaScriptSource.prototype -} - -/** - * @constructor - * @implements {WebInspector.ScriptFile} - * @extends {WebInspector.Object} - * @param {WebInspector.ScriptSnippetModel} scriptSnippetModel - * @param {WebInspector.SnippetJavaScriptSource} snippetJavaScriptSource - */ -WebInspector.SnippetScriptFile = function(scriptSnippetModel, snippetJavaScriptSource) -{ - WebInspector.ScriptFile.call(this); - this._scriptSnippetModel = scriptSnippetModel; - this._snippetJavaScriptSource = snippetJavaScriptSource; - this._hasDivergedFromVM = true; -} - -WebInspector.SnippetScriptFile.prototype = { /** * @return {boolean} */ - hasDivergedFromVM: function() + isEditable: function() { - return this._hasDivergedFromVM; + return true; }, /** - * @param {boolean} hasDivergedFromVM + * @return {boolean} */ - setHasDivergedFromVM: function(hasDivergedFromVM) + isDivergedFromVM: function() { - this._hasDivergedFromVM = hasDivergedFromVM; + return this._scriptSnippetModel._isDivergedFromVM(this); }, /** - * @return {boolean} + * @param {function(?string)} callback */ - isDivergingFromVM: function() + workingCopyCommitted: function(callback) + { + this._scriptSnippetModel._setScriptSnippetContent(this, this.workingCopy()); + callback(null); + }, + + workingCopyChanged: function() + { + this._scriptSnippetModel._scriptSnippetEdited(this); + }, + + evaluate: function() { - return this._isDivergingFromVM; + this._scriptSnippetModel.evaluateScriptSnippet(this); }, /** - * @param {boolean} isDivergingFromVM + * @return {boolean} */ - setIsDivergingFromVM: function(isDivergingFromVM) + supportsEnabledBreakpointsWhileEditing: function() { - this._isDivergingFromVM = isDivergingFromVM; + return true; }, /** - * @param {function(?string)} callback + * @return {string} */ - workingCopyCommitted: function(callback) + breakpointStorageId: function() { - this._scriptSnippetModel._setScriptSnippetContent(this._snippetJavaScriptSource, this._snippetJavaScriptSource.workingCopy()); - callback(null); + return WebInspector.ScriptSnippetModel.snippetSourceURLPrefix + this.snippetId; }, - workingCopyChanged: function() + /** + * @return {string} + */ + get snippetId() { - this._scriptSnippetModel._scriptSnippetEdited(this._snippetJavaScriptSource); - }, - - __proto__: WebInspector.Object.prototype + return this._snippetId; + } } +WebInspector.SnippetJavaScriptSource.prototype.__proto__ = WebInspector.JavaScriptSource.prototype; + /** * @constructor * @implements {WebInspector.SourceMapping} @@ -562,9 +508,7 @@ WebInspector.SnippetContentProvider = function(snippet) WebInspector.StaticContentProvider.call(this, WebInspector.resourceTypes.Script, snippet.content); } -WebInspector.SnippetContentProvider.prototype = { - __proto__: WebInspector.StaticContentProvider.prototype -} +WebInspector.SnippetContentProvider.prototype.__proto__ = WebInspector.StaticContentProvider.prototype; /** * @type {?WebInspector.ScriptSnippetModel} diff --git a/Source/WebCore/inspector/front-end/ScriptsNavigator.js b/Source/WebCore/inspector/front-end/ScriptsNavigator.js index d094e644e..2eeef73c7 100644 --- a/Source/WebCore/inspector/front-end/ScriptsNavigator.js +++ b/Source/WebCore/inspector/front-end/ScriptsNavigator.js @@ -130,6 +130,17 @@ WebInspector.ScriptsNavigator.prototype = { }, /** + * @param {WebInspector.UISourceCode} oldUISourceCode + * @param {WebInspector.UISourceCode} uiSourceCode + */ + replaceUISourceCode: function(oldUISourceCode, uiSourceCode) + { + this._scriptsView.replaceUISourceCode(oldUISourceCode, uiSourceCode); + this._contentScriptsView.replaceUISourceCode(oldUISourceCode, uiSourceCode); + this._snippetsView.replaceUISourceCode(oldUISourceCode, uiSourceCode); + }, + + /** * @param {WebInspector.UISourceCode} uiSourceCode * @param {function(boolean)=} callback */ @@ -175,11 +186,11 @@ WebInspector.ScriptsNavigator.prototype = { this._scriptsView.reset(); this._contentScriptsView.reset(); this._snippetsView.reset(); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.ScriptsNavigator.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @extends {WebInspector.NavigatorView} @@ -230,7 +241,7 @@ WebInspector.SnippetsNavigatorView.prototype = { if (!uiSourceCode.isSnippet) return; var snippetJavaScriptSource = /** @type {WebInspector.SnippetJavaScriptSource} */ uiSourceCode; - WebInspector.scriptSnippetModel.evaluateScriptSnippet(snippetJavaScriptSource); + snippetJavaScriptSource.evaluate(); }, /** @@ -265,7 +276,7 @@ WebInspector.SnippetsNavigatorView.prototype = { _snippetCreationRequested: function() { this.dispatchEventToListeners(WebInspector.SnippetsNavigatorView.Events.SnippetCreationRequested, null); - }, - - __proto__: WebInspector.NavigatorView.prototype + } } + +WebInspector.SnippetsNavigatorView.prototype.__proto__ = WebInspector.NavigatorView.prototype; diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index e810985a6..f4dc77219 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -194,8 +194,8 @@ WebInspector.ScriptsPanel = function(workspaceForTest) WebInspector.endBatchUpdate(); this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this); + this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this); this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this); - this._workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeRemoved, this._uiSourceCodeRemoved, this); this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset, this._reset.bind(this), this); WebInspector.advancedSearchController.registerSearchScope(new WebInspector.ScriptsSearchScope(this._workspace)); @@ -247,7 +247,7 @@ WebInspector.ScriptsPanel.prototype = { _addUISourceCode: function(uiSourceCode) { if (this._toggleFormatSourceButton.toggled) - uiSourceCode.setFormatted(true, this._uiSourceCodeFormatted.bind(this, uiSourceCode)); + uiSourceCode.setFormatted(true); this._navigator.addUISourceCode(uiSourceCode); this._editorContainer.addUISourceCode(uiSourceCode); @@ -299,7 +299,7 @@ WebInspector.ScriptsPanel.prototype = { else if (details.reason === WebInspector.DebuggerModel.BreakReason.Assert) this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on assertion.")); else if (details.reason === WebInspector.DebuggerModel.BreakReason.CSPViolation) - this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a script blocked due to Content Security Policy directive: \"%s\".", details.auxData["directiveText"])); + this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a script blocked due to Content Security Policy directive: \"%s\".", details.auxData.directiveText)); else { function didGetUILocation(uiLocation) { @@ -482,6 +482,19 @@ WebInspector.ScriptsPanel.prototype = { sourceFrame.detach(); }, + /** + * @param {WebInspector.Event} event + */ + _uiSourceCodeReplaced: function(event) + { + var oldUISourceCode = /** @type {WebInspector.UISourceCode} */ event.data.oldUISourceCode; + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode; + + this._navigator.replaceUISourceCode(oldUISourceCode, uiSourceCode); + this._editorContainer.replaceFile(oldUISourceCode, uiSourceCode); + this._removeSourceFrame(oldUISourceCode); + }, + _clearCurrentExecutionLine: function() { if (this._executionSourceFrame) @@ -503,16 +516,9 @@ WebInspector.ScriptsPanel.prototype = { _revealExecutionLine: function(uiLocation) { - var uiSourceCode = uiLocation.uiSourceCode; // Some scripts (anonymous and snippets evaluations) are not added to files select by default. - if (uiSourceCode.isTemporary) { - if (this._currentUISourceCode && this._currentUISourceCode.scriptFile() && this._currentUISourceCode.scriptFile().isDivergingFromVM()) - return; - this._editorContainer.addUISourceCode(uiSourceCode); - if (uiSourceCode.formatted() !== this._toggleFormatSourceButton.toggled) - uiSourceCode.setFormatted(this._toggleFormatSourceButton.toggled, this._uiSourceCodeFormatted.bind(this, uiSourceCode)); - } - var sourceFrame = this._showFile(uiSourceCode); + this._editorContainer.addUISourceCode(uiLocation.uiSourceCode); + var sourceFrame = this._showFile(uiLocation.uiSourceCode); sourceFrame.revealLine(uiLocation.lineNumber); sourceFrame.focus(); }, @@ -593,7 +599,6 @@ WebInspector.ScriptsPanel.prototype = { } if (this._paused) { - this._updateButtonTitle(this.pauseButton, WebInspector.UIString("Resume script execution (%s).")) this.pauseButton.addStyleClass("paused"); this.pauseButton.disabled = false; @@ -603,7 +608,6 @@ WebInspector.ScriptsPanel.prototype = { this.debuggerStatusElement.textContent = WebInspector.UIString("Paused"); } else { - this._updateButtonTitle(this.pauseButton, WebInspector.UIString("Pause script execution (%s).")) this.pauseButton.removeStyleClass("paused"); this.pauseButton.disabled = this._waitingToPause; @@ -754,11 +758,12 @@ WebInspector.ScriptsPanel.prototype = { var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta; // Continue. + title = WebInspector.UIString("Pause script execution (%s)."); handler = this._togglePause.bind(this); shortcuts = []; shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8)); shortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, platformSpecificModifier)); - this.pauseButton = this._createButtonAndRegisterShortcuts(section, "scripts-pause", "", handler, shortcuts, WebInspector.UIString("Pause/Continue")); + this.pauseButton = this._createButtonAndRegisterShortcuts(section, "scripts-pause", title, handler, shortcuts, WebInspector.UIString("Pause/Continue")); debugToolbar.appendChild(this.pauseButton); // Step over. @@ -800,23 +805,12 @@ WebInspector.ScriptsPanel.prototype = { return debugToolbar; }, - _updateButtonTitle: function(button, buttonTitle) - { - button.buttonTitle = buttonTitle; - var hasShortcuts = button.shortcuts && button.shortcuts.length; - if (hasShortcuts) - button.title = String.vsprintf(buttonTitle, [button.shortcuts[0].name]); - else - button.title = buttonTitle; - }, - _createButtonAndRegisterShortcuts: function(section, buttonId, buttonTitle, handler, shortcuts, shortcutDescription) { var button = document.createElement("button"); button.className = "status-bar-item"; button.id = buttonId; - button.shortcuts = shortcuts; - this._updateButtonTitle(button, buttonTitle); + button.title = String.vsprintf(buttonTitle, [shortcuts[0].name]); button.disabled = true; button.appendChild(document.createElement("img")); button.addEventListener("click", handler, false); @@ -934,18 +928,12 @@ WebInspector.ScriptsPanel.prototype = { view.replaceAllWith(query, text); }, - _uiSourceCodeFormatted: function(uiSourceCode) - { - if (uiSourceCode instanceof WebInspector.JavaScriptSource) - WebInspector.breakpointManager.restoreBreakpoints(uiSourceCode); - }, - _toggleFormatSource: function() { this._toggleFormatSourceButton.toggled = !this._toggleFormatSourceButton.toggled; var uiSourceCodes = this._workspace.uiSourceCodes(); for (var i = 0; i < uiSourceCodes.length; ++i) - uiSourceCodes[i].setFormatted(this._toggleFormatSourceButton.toggled, this._uiSourceCodeFormatted.bind(this, uiSourceCodes[i])); + uiSourceCodes[i].setFormatted(this._toggleFormatSourceButton.toggled); }, addToWatch: function(expression) @@ -1112,9 +1100,8 @@ WebInspector.ScriptsPanel.prototype = { var uiSourceCode = /** @type {WebInspector.UISourceCode} */ target; contextMenu.appendItem(WebInspector.UIString("Local modifications..."), this._showLocalHistory.bind(this, uiSourceCode)); - var resource = WebInspector.resourceForURL(uiSourceCode.url); - if (resource && resource.request) - contextMenu.appendApplicableItems(resource.request); + if (uiSourceCode.resource() && uiSourceCode.resource().request) + contextMenu.appendApplicableItems(uiSourceCode.resource().request); }, /** @@ -1151,7 +1138,7 @@ WebInspector.ScriptsPanel.prototype = { showGoToSourceDialog: function() { WebInspector.OpenResourceDialog.show(this, this._workspace, this.editorView.mainElement); - }, - - __proto__: WebInspector.Panel.prototype + } } + +WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype; diff --git a/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js b/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js index 99edfafef..5516f1f23 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanelDescriptor.js @@ -53,7 +53,7 @@ WebInspector.ScriptsPanelDescriptor.prototype = { } this.panel().appendApplicableItems(contextMenu, target); - }, - - __proto__: WebInspector.PanelDescriptor.prototype + } } + +WebInspector.ScriptsPanelDescriptor.prototype.__proto__ = WebInspector.PanelDescriptor.prototype; diff --git a/Source/WebCore/inspector/front-end/ScriptsSearchScope.js b/Source/WebCore/inspector/front-end/ScriptsSearchScope.js index 1f9a40eb6..c19d1ecf5 100644 --- a/Source/WebCore/inspector/front-end/ScriptsSearchScope.js +++ b/Source/WebCore/inspector/front-end/ScriptsSearchScope.js @@ -124,7 +124,7 @@ WebInspector.ScriptsSearchScope.prototype = { uiSourceCodes.sort(comparator); return uiSourceCodes; - }, - - __proto__: WebInspector.SearchScope.prototype + } } + +WebInspector.ScriptsSearchScope.prototype.__proto__ = WebInspector.SearchScope.prototype; diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index cc98b4cd5..a138cb658 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -43,8 +43,7 @@ var Preferences = { exposeDisableCache: false, applicationTitle: "Web Inspector - %s", showDockToRight: false, - exposeFileSystemInspection: false, - experimentsEnabled: true + exposeFileSystemInspection: false } var Capabilities = { @@ -66,7 +65,7 @@ WebInspector.Settings = function() { this._eventSupport = new WebInspector.Object(); - this.colorFormat = this.createSetting("colorFormat", "original"); + this.colorFormat = this.createSetting("colorFormat", "hex"); this.consoleHistory = this.createSetting("consoleHistory", []); this.debuggerEnabled = this.createSetting("debuggerEnabled", false); this.domWordWrap = this.createSetting("domWordWrap", true); @@ -93,9 +92,9 @@ WebInspector.Settings = function() this.deviceMetrics = this.createSetting("deviceMetrics", ""); this.deviceFitWindow = this.createSetting("deviceFitWindow", false); this.showScriptFolders = this.createSetting("showScriptFolders", true); + this.dockToRight = this.createSetting("dockToRight", false); this.emulateTouchEvents = this.createSetting("emulateTouchEvents", false); this.showPaintRects = this.createSetting("showPaintRects", false); - this.showShadowDOM = this.createSetting("showShadowDOM", false); this.zoomLevel = this.createSetting("zoomLevel", 0); this.savedURLs = this.createSetting("savedURLs", {}); this.javaScriptDisabled = this.createSetting("javaScriptDisabled", false); @@ -104,7 +103,6 @@ WebInspector.Settings = function() this.showHeapSnapshotObjectsHiddenProperties = this.createSetting("showHeaSnapshotObjectsHiddenProperties", false); this.searchInContentScripts = this.createSetting("searchInContentScripts", false); this.textEditorIndent = this.createSetting("textEditorIndent", " "); - this.lastDockState = this.createSetting("lastDockState", ""); // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused // periodical breakpoints duplication leading to inspector slowness. @@ -188,6 +186,7 @@ WebInspector.ExperimentsSettings = function() this._enabledForTest = {}; // Add currently running experiments here. + this.showShadowDOM = this._createExperiment("showShadowDOM", "Show shadow DOM"); this.snippetsSupport = this._createExperiment("snippetsSupport", "Snippets support"); this.nativeMemorySnapshots = this._createExperiment("nativeMemorySnapshots", "Native memory profiling"); this.liveNativeMemoryChart = this._createExperiment("liveNativeMemoryChart", "Live native memory chart"); @@ -217,7 +216,7 @@ WebInspector.ExperimentsSettings.prototype = { */ get experimentsEnabled() { - return Preferences.experimentsEnabled || ("experiments" in WebInspector.queryParamsObject); + return "experiments" in WebInspector.queryParamsObject; }, /** diff --git a/Source/WebCore/inspector/front-end/SettingsScreen.js b/Source/WebCore/inspector/front-end/SettingsScreen.js index f57e3e802..1c98e3e40 100644 --- a/Source/WebCore/inspector/front-end/SettingsScreen.js +++ b/Source/WebCore/inspector/front-end/SettingsScreen.js @@ -107,11 +107,11 @@ WebInspector.SettingsScreen.prototype = { { this._onHide(); WebInspector.HelpScreen.prototype.willHide.call(this); - }, - - __proto__: WebInspector.HelpScreen.prototype + } } +WebInspector.SettingsScreen.prototype.__proto__ = WebInspector.HelpScreen.prototype; + /** * @constructor * @extends {WebInspector.View} @@ -236,11 +236,11 @@ WebInspector.SettingsTab.prototype = { fieldsetElement.appendChild(element); p.appendChild(fieldsetElement); return p; - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.SettingsTab.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.SettingsTab} @@ -250,6 +250,8 @@ WebInspector.GenericSettingsTab = function() WebInspector.SettingsTab.call(this); var p = this._appendSection(); + if (Preferences.showDockToRight) + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Dock to right"), WebInspector.settings.dockToRight)); if (Preferences.exposeDisableCache) p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled)); var disableJSElement = this._createCheckboxSetting(WebInspector.UIString("Disable JavaScript"), WebInspector.settings.javaScriptDisabled); @@ -266,7 +268,6 @@ WebInspector.GenericSettingsTab = function() [ WebInspector.Color.Format.HSL, "HSL: hsl(300, 80%, 90%)" ] ], WebInspector.settings.colorFormat)); p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show user agent styles"), WebInspector.settings.showUserAgentStyles)); p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Word wrap"), WebInspector.settings.domWordWrap)); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show Shadow DOM"), WebInspector.settings.showShadowDOM)); p = this._appendSection(WebInspector.UIString("Rendering")); p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show paint rectangles"), WebInspector.settings.showPaintRects)); @@ -331,11 +332,11 @@ WebInspector.GenericSettingsTab.prototype = { { // We need to manually update the checkbox state, since enabling JavaScript in the page can actually uncover the "forbidden" state. PageAgent.setScriptExecutionDisabled(WebInspector.settings.javaScriptDisabled.get(), this._updateScriptDisabledCheckbox.bind(this)); - }, - - __proto__: WebInspector.SettingsTab.prototype + } } +WebInspector.GenericSettingsTab.prototype.__proto__ = WebInspector.SettingsTab.prototype; + /** * @constructor * @extends {WebInspector.SettingsTab} @@ -861,11 +862,11 @@ WebInspector.UserAgentSettingsTab.prototype = { this._gammaElement = this._createInput(cellElement, "device-orientation-override-gamma", String(deviceOrientation.gamma), this._applyDeviceOrientationUserInput.bind(this)); return fieldsetElement; - }, - - __proto__: WebInspector.SettingsTab.prototype + } } +WebInspector.UserAgentSettingsTab.prototype.__proto__ = WebInspector.SettingsTab.prototype; + /** * @constructor * @extends {WebInspector.SettingsTab} @@ -916,11 +917,11 @@ WebInspector.ExperimentsSettingsTab.prototype = { label.appendChild(document.createTextNode(WebInspector.UIString(experiment.title))); p.appendChild(label); return p; - }, - - __proto__: WebInspector.SettingsTab.prototype + } } +WebInspector.ExperimentsSettingsTab.prototype.__proto__ = WebInspector.SettingsTab.prototype; + /** * @constructor */ diff --git a/Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js b/Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js index 7914a1b89..ee7ee3990 100644 --- a/Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js +++ b/Source/WebCore/inspector/front-end/ShowMoreDataGridNode.js @@ -140,8 +140,7 @@ WebInspector.ShowMoreDataGridNode.prototype = { dispose: function() { - }, - - __proto__: WebInspector.DataGridNode.prototype -} + } +}; +WebInspector.ShowMoreDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype; diff --git a/Source/WebCore/inspector/front-end/SidebarPane.js b/Source/WebCore/inspector/front-end/SidebarPane.js index 075a6eb8b..af6ed1abd 100644 --- a/Source/WebCore/inspector/front-end/SidebarPane.js +++ b/Source/WebCore/inspector/front-end/SidebarPane.js @@ -132,7 +132,7 @@ WebInspector.SidebarPane.prototype = { { if (isEnterKey(event) || event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code) this.toggleExpanded(); - }, - - __proto__: WebInspector.Object.prototype + } } + +WebInspector.SidebarPane.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/SidebarTreeElement.js b/Source/WebCore/inspector/front-end/SidebarTreeElement.js index 398abc852..427cdc595 100644 --- a/Source/WebCore/inspector/front-end/SidebarTreeElement.js +++ b/Source/WebCore/inspector/front-end/SidebarTreeElement.js @@ -68,11 +68,11 @@ WebInspector.SidebarSectionTreeElement.prototype = { { if (this.listItemElement) this.listItemElement.scrollIntoViewIfNeeded(false); - }, - - __proto__: TreeElement.prototype + } } +WebInspector.SidebarSectionTreeElement.prototype.__proto__ = TreeElement.prototype; + /** * @constructor * @extends {TreeElement} @@ -222,7 +222,7 @@ WebInspector.SidebarTreeElement.prototype = { { if (this._listItemNode) this._listItemNode.scrollIntoViewIfNeeded(false); - }, - - __proto__: TreeElement.prototype + } } + +WebInspector.SidebarTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/Source/WebCore/inspector/front-end/SnippetJavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/SnippetJavaScriptSourceFrame.js index 75e01cfb6..587dd7bb1 100644 --- a/Source/WebCore/inspector/front-end/SnippetJavaScriptSourceFrame.js +++ b/Source/WebCore/inspector/front-end/SnippetJavaScriptSourceFrame.js @@ -54,8 +54,8 @@ WebInspector.SnippetJavaScriptSourceFrame.prototype = { _runButtonClicked: function() { - WebInspector.scriptSnippetModel.evaluateScriptSnippet(this._snippetJavaScriptSource); - }, - - __proto__: WebInspector.JavaScriptSourceFrame.prototype + this._snippetJavaScriptSource.evaluate(); + } } + +WebInspector.SnippetJavaScriptSourceFrame.prototype.__proto__ = WebInspector.JavaScriptSourceFrame.prototype; diff --git a/Source/WebCore/inspector/front-end/SnippetStorage.js b/Source/WebCore/inspector/front-end/SnippetStorage.js index 4bdc87368..4a525c9c2 100644 --- a/Source/WebCore/inspector/front-end/SnippetStorage.js +++ b/Source/WebCore/inspector/front-end/SnippetStorage.js @@ -120,11 +120,11 @@ WebInspector.SnippetStorage.prototype = { this._lastSnippetIdentifierSetting.set(0); this._snippetsSetting.set([]); this._snippets = {}; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.SnippetStorage.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @extends {WebInspector.Object} @@ -204,7 +204,7 @@ WebInspector.Snippet.prototype = { serializedSnippet.name = this.name; serializedSnippet.content = this.content; return serializedSnippet; - }, - - __proto__: WebInspector.Object.prototype + } } + +WebInspector.Snippet.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js b/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js index aa7d42b80..618913969 100644 --- a/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js +++ b/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js @@ -1565,7 +1565,7 @@ case 150: } } - }, - - __proto__: WebInspector.SourceTokenizer.prototype + } } + +WebInspector.SourceCSSTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype; diff --git a/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js b/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js index 659eb93ce..f33f5a924 100644 --- a/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js +++ b/Source/WebCore/inspector/front-end/SourceCSSTokenizer.re2js @@ -333,7 +333,7 @@ WebInspector.SourceCSSTokenizer.prototype = { <*> [^] { this.tokenType = null; return cursor; } */ } - }, - - __proto__: WebInspector.SourceTokenizer.prototype + } } + +WebInspector.SourceCSSTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype; diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index 7ccb94d45..cb930e14f 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -650,11 +650,11 @@ WebInspector.SourceFrame.prototype = { if (this._url && WebInspector.fileManager.isURLSaved(this._url)) WebInspector.fileManager.save(this._url, content, false); return true; - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.SourceFrame.prototype.__proto__ = WebInspector.View.prototype; + /** * @implements {WebInspector.TextEditorDelegate} @@ -706,7 +706,7 @@ WebInspector.TextEditorDelegateForSourceFrame.prototype = { { var targetLocation = WebInspector.ParsedURL.completeURL(this._sourceFrame._url, hrefValue); return WebInspector.linkifyURLAsNode(targetLocation || hrefValue, hrefValue, undefined, isExternal); - }, - - __proto__: WebInspector.TextEditorDelegate.prototype + } } + +WebInspector.TextEditorDelegateForSourceFrame.prototype.__proto__ = WebInspector.TextEditorDelegate.prototype; diff --git a/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js b/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js index e114044aa..b4770cc43 100644 --- a/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js +++ b/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js @@ -810,7 +810,7 @@ case 119: } } - }, - - __proto__: WebInspector.SourceTokenizer.prototype + } } + +WebInspector.SourceHTMLTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype; diff --git a/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js b/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js index 140d7cac8..a8deedf7f 100644 --- a/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js +++ b/Source/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js @@ -385,7 +385,7 @@ WebInspector.SourceHTMLTokenizer.prototype = { <*> [^] { this.tokenType = null; return cursor; } */ } - }, - - __proto__: WebInspector.SourceTokenizer.prototype + } } + +WebInspector.SourceHTMLTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype; diff --git a/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js b/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js index 1e0e3e8e0..0c7dccb69 100644 --- a/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js +++ b/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js @@ -2438,7 +2438,7 @@ case 300: } } - }, - - __proto__: WebInspector.SourceTokenizer.prototype + } } + +WebInspector.SourceJavaScriptTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype; diff --git a/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js b/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js index 29345d125..34a678634 100644 --- a/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js +++ b/Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js @@ -192,7 +192,7 @@ WebInspector.SourceJavaScriptTokenizer.prototype = { <*> [^] { this.tokenType = null; return cursor; } */ } - }, - - __proto__: WebInspector.SourceTokenizer.prototype + } } + +WebInspector.SourceJavaScriptTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype; diff --git a/Source/WebCore/inspector/front-end/Spectrum.js b/Source/WebCore/inspector/front-end/Spectrum.js index 4e7fdc151..0cd4803e8 100644 --- a/Source/WebCore/inspector/front-end/Spectrum.js +++ b/Source/WebCore/inspector/front-end/Spectrum.js @@ -455,7 +455,7 @@ WebInspector.Spectrum.prototype = { this.hide(false); event.consume(true); } - }, - - __proto__: WebInspector.Object.prototype + } } + +WebInspector.Spectrum.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/SplitView.js b/Source/WebCore/inspector/front-end/SplitView.js index 111c3e2b8..467899cfa 100644 --- a/Source/WebCore/inspector/front-end/SplitView.js +++ b/Source/WebCore/inspector/front-end/SplitView.js @@ -442,7 +442,7 @@ WebInspector.SplitView.prototype = { elementsToRestoreScrollPositionsFor: function() { return [ this.mainElement, this.sidebarElement ]; - }, - - __proto__: WebInspector.View.prototype + } } + +WebInspector.SplitView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/Source/WebCore/inspector/front-end/StatusBarButton.js b/Source/WebCore/inspector/front-end/StatusBarButton.js index 414c6b30b..9194302d5 100644 --- a/Source/WebCore/inspector/front-end/StatusBarButton.js +++ b/Source/WebCore/inspector/front-end/StatusBarButton.js @@ -57,7 +57,6 @@ WebInspector.StatusBarButton = function(title, className, states) this._state = 0; this.title = title; - this.className = className; this.disabled = false; this._visible = true; } @@ -193,10 +192,6 @@ WebInspector.StatusBarButton.prototype = { _showOptions: function(buttonsProvider) { var buttons = buttonsProvider(); - var mainButtonClone = new WebInspector.StatusBarButton(this.title, this.className, this.states); - mainButtonClone.addEventListener("click", this._clicked, this); - mainButtonClone.state = this.state; - buttons.push(mainButtonClone); var mouseUpListener = mouseUp.bind(this); document.documentElement.addEventListener("mouseup", mouseUpListener, false); @@ -210,8 +205,8 @@ WebInspector.StatusBarButton.prototype = { var boundMouseOver = mouseOver.bind(this); var boundMouseOut = mouseOut.bind(this); for (var i = 0; i < buttons.length; ++i) { - buttons[i].element.addEventListener("mousemove", boundMouseOver, false); - buttons[i].element.addEventListener("mouseout", boundMouseOut, false); + buttons[i].element.addEventListener("mousemove", boundMouseOver.bind(this), false); + buttons[i].element.addEventListener("mouseout", boundMouseOut.bind(this), false); optionsBarElement.appendChild(buttons[i].element); } buttons[buttons.length - 1].element.addStyleClass("emulate-active"); @@ -244,11 +239,11 @@ WebInspector.StatusBarButton.prototype = { buttons[i]._clicked(); } } - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.StatusBarButton.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {?function(Event)} changeHandler diff --git a/Source/WebCore/inspector/front-end/StyleSheetOutlineDialog.js b/Source/WebCore/inspector/front-end/StyleSheetOutlineDialog.js index 553714130..25141bda0 100644 --- a/Source/WebCore/inspector/front-end/StyleSheetOutlineDialog.js +++ b/Source/WebCore/inspector/front-end/StyleSheetOutlineDialog.js @@ -157,7 +157,7 @@ WebInspector.StyleSheetOutlineDialog.prototype = { rewriteQuery: function(query) { return query; - }, - - __proto__: WebInspector.SelectionDialogContentProvider.prototype + } } + +WebInspector.StyleSheetOutlineDialog.prototype.__proto__ = WebInspector.SelectionDialogContentProvider.prototype; diff --git a/Source/WebCore/inspector/front-end/StyleSource.js b/Source/WebCore/inspector/front-end/StyleSource.js index 9231a260d..4d21f518a 100644 --- a/Source/WebCore/inspector/front-end/StyleSource.js +++ b/Source/WebCore/inspector/front-end/StyleSource.js @@ -29,13 +29,65 @@ /** * @constructor * @extends {WebInspector.UISourceCode} - * @param {WebInspector.ContentProvider} contentProvider + * @param {WebInspector.Resource} resource */ -WebInspector.StyleSource = function(contentProvider) +WebInspector.StyleSource = function(resource) { - WebInspector.UISourceCode.call(this, contentProvider.contentURL(), contentProvider, true); + WebInspector.UISourceCode.call(this, resource.url, resource, resource); } +WebInspector.StyleSource.updateTimeout = 200; + WebInspector.StyleSource.prototype = { - __proto__: WebInspector.UISourceCode.prototype + /** + * @return {boolean} + */ + isEditable: function() + { + return true; + }, + + /** + * @param {function(?string)} callback + */ + workingCopyCommitted: function(callback) + { + this._commitIncrementalEdit(true, callback); + }, + + workingCopyChanged: function() + { + this._callOrSetTimeout(this._commitIncrementalEdit.bind(this, false, function() {})); + }, + + /** + * @param {function(?string)} callback + */ + _callOrSetTimeout: function(callback) + { + // FIXME: Extensions tests override updateTimeout because extensions don't have any control over applying changes to domain specific bindings. + if (WebInspector.StyleSource.updateTimeout >= 0) + this._incrementalUpdateTimer = setTimeout(callback, WebInspector.StyleSource.updateTimeout); + else + callback(null); + }, + + /** + * @param {boolean} majorChange + * @param {function(?string)} callback + */ + _commitIncrementalEdit: function(majorChange, callback) + { + this._clearIncrementalUpdateTimer(); + WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), majorChange, callback); + }, + + _clearIncrementalUpdateTimer: function() + { + if (this._incrementalUpdateTimer) + clearTimeout(this._incrementalUpdateTimer); + delete this._incrementalUpdateTimer; + } } + +WebInspector.StyleSource.prototype.__proto__ = WebInspector.UISourceCode.prototype; diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js index af07068fb..e18c6359c 100644 --- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js @@ -783,11 +783,11 @@ WebInspector.StylesSidebarPane.prototype = { { if (this._spectrum.visible) this._spectrum.hide(false); - }, - - __proto__: WebInspector.SidebarPane.prototype + } } +WebInspector.StylesSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + /** * @constructor * @extends {WebInspector.SidebarPane} @@ -826,11 +826,11 @@ WebInspector.ComputedStyleSidebarPane.prototype = { } this._stylesSidebarPane._refreshUpdate(null, true, callback.bind(this)); - }, - - __proto__: WebInspector.SidebarPane.prototype + } } +WebInspector.ComputedStyleSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + /** * @constructor * @extends {WebInspector.PropertiesSection} @@ -1045,7 +1045,7 @@ WebInspector.StylePropertiesSection.prototype = { var isShorthand = !!WebInspector.CSSCompletions.cssPropertiesMetainfo.longhands(property.name); var inherited = this.isPropertyInherited(property.name); - var overloaded = property.inactive || this.isPropertyOverloaded(property.name); + var overloaded = this.isPropertyOverloaded(property.name); var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded); this.propertiesTreeOutline.appendChild(item); } @@ -1079,7 +1079,7 @@ WebInspector.StylePropertiesSection.prototype = { // Generate synthetic shorthand we have a value for. var shorthandProperty = new WebInspector.CSSProperty(style, style.allProperties.length, shorthand, style.shorthandValue(shorthand), "", "style", true, true, undefined); - var overloaded = property.inactive || this.isPropertyOverloaded(property.name, true); + var overloaded = this.isPropertyOverloaded(property.name, true); var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, shorthandProperty, /* isShorthand */ true, /* inherited */ false, overloaded); this.propertiesTreeOutline.appendChild(item); generatedShorthands[shorthand] = shorthandProperty; @@ -1089,7 +1089,7 @@ WebInspector.StylePropertiesSection.prototype = { continue; // Shorthand for the property found. var inherited = this.isPropertyInherited(property.name); - var overloaded = property.inactive || this.isPropertyOverloaded(property.name, isShorthand); + var overloaded = this.isPropertyOverloaded(property.name, isShorthand); var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded); this.propertiesTreeOutline.appendChild(item); } @@ -1342,11 +1342,11 @@ WebInspector.StylePropertiesSection.prototype = { // Do nothing but mark the selectors in group if necessary. // This is overridden by BlankStylePropertiesSection. this._markSelectorMatches(); - }, - - __proto__: WebInspector.PropertiesSection.prototype + } } +WebInspector.StylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; + /** * @constructor * @extends {WebInspector.PropertiesSection} @@ -1450,7 +1450,7 @@ WebInspector.ComputedStylePropertiesSection.prototype = { subtitle.appendChild(section._createRuleOriginNode()); var childElement = new TreeElement(fragment, null, false); treeElement.appendChild(childElement); - if (property.inactive || section.isPropertyOverloaded(property.name)) + if (section.isPropertyOverloaded(property.name)) childElement.listItemElement.addStyleClass("overloaded"); if (!property.parsedOk) childElement.listItemElement.addStyleClass("not-parsed-ok"); @@ -1463,11 +1463,11 @@ WebInspector.ComputedStylePropertiesSection.prototype = { if (name in this._propertyTreeElements) this._propertyTreeElements[name].expand(); } - }, - - __proto__: WebInspector.PropertiesSection.prototype + } } +WebInspector.ComputedStylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; + /** * @constructor * @extends {WebInspector.StylePropertiesSection} @@ -1538,11 +1538,11 @@ WebInspector.BlankStylePropertiesSection.prototype = { // FIXME: replace this instance by a normal WebInspector.StylePropertiesSection. this._normal = true; - }, - - __proto__: WebInspector.StylePropertiesSection.prototype + } } +WebInspector.BlankStylePropertiesSection.prototype.__proto__ = WebInspector.StylePropertiesSection.prototype; + /** * @constructor * @extends {TreeElement} @@ -2505,11 +2505,11 @@ WebInspector.StylePropertyTreeElement.prototype = { if (!this.section.computedStyle) return event.target === this._expandElement; return TreeElement.prototype.isEventWithinDisclosureTriangle.call(this, event); - }, - - __proto__: TreeElement.prototype + } } +WebInspector.StylePropertyTreeElement.prototype.__proto__ = TreeElement.prototype; + /** * @constructor * @extends {WebInspector.TextPrompt} @@ -2583,22 +2583,15 @@ WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype = { return this._cssCompletions.keySet().hasOwnProperty(word); }, - /** - * @param {Element} proxyElement - * @param {Range} wordRange - * @param {boolean} force - * @param {function(Array.<string>, number=)} completionsReadyCallback - */ - _buildPropertyCompletions: function(proxyElement, wordRange, force, completionsReadyCallback) + _buildPropertyCompletions: function(textPrompt, wordRange, force, completionsReadyCallback) { var prefix = wordRange.toString().toLowerCase(); if (!prefix && !force) return; var results = this._cssCompletions.startsWith(prefix); - var selectedIndex = this._cssCompletions.mostUsedOf(results); - completionsReadyCallback(results, selectedIndex); - }, - - __proto__: WebInspector.TextPrompt.prototype + completionsReadyCallback(results); + } } + +WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspector.TextPrompt.prototype; diff --git a/Source/WebCore/inspector/front-end/StylesSourceMapping.js b/Source/WebCore/inspector/front-end/StylesSourceMapping.js index ebae4eafe..0767e9ae0 100644 --- a/Source/WebCore/inspector/front-end/StylesSourceMapping.js +++ b/Source/WebCore/inspector/front-end/StylesSourceMapping.js @@ -70,7 +70,7 @@ WebInspector.StylesSourceMapping.prototype = { var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; if (!uiSourceCode.url || this._uiSourceCodeForURL[uiSourceCode.url]) return; - if (uiSourceCode.contentType() !== WebInspector.resourceTypes.Stylesheet) + if (uiSourceCode.contentType() !== WebInspector.resourceTypes.StyleSheet) return; this._addUISourceCode(uiSourceCode); @@ -83,8 +83,6 @@ WebInspector.StylesSourceMapping.prototype = { { this._uiSourceCodeForURL[uiSourceCode.url] = uiSourceCode; uiSourceCode.setSourceMapping(this); - var styleFile = new WebInspector.StyleFile(uiSourceCode); - uiSourceCode.setStyleFile(styleFile); WebInspector.cssModel.setSourceMapping(uiSourceCode.url, this); }, @@ -95,165 +93,3 @@ WebInspector.StylesSourceMapping.prototype = { } } -/** - * @constructor - * @param {WebInspector.UISourceCode} uiSourceCode - */ -WebInspector.StyleFile = function(uiSourceCode) -{ - this._uiSourceCode = uiSourceCode; -} - -WebInspector.StyleFile.updateTimeout = 200; - -WebInspector.StyleFile.prototype = { - /** - * @param {function(?string)} callback - */ - workingCopyCommitted: function(callback) - { - this._commitIncrementalEdit(true, callback); - }, - - workingCopyChanged: function() - { - this._callOrSetTimeout(this._commitIncrementalEdit.bind(this, false, function() {})); - }, - - /** - * @param {function(?string)} callback - */ - _callOrSetTimeout: function(callback) - { - // FIXME: Extensions tests override updateTimeout because extensions don't have any control over applying changes to domain specific bindings. - if (WebInspector.StyleFile.updateTimeout >= 0) - this._incrementalUpdateTimer = setTimeout(callback, WebInspector.StyleFile.updateTimeout); - else - callback(null); - }, - - /** - * @param {boolean} majorChange - * @param {function(?string)} callback - */ - _commitIncrementalEdit: function(majorChange, callback) - { - this._clearIncrementalUpdateTimer(); - WebInspector.styleContentBinding.setStyleContent(this._uiSourceCode, this._uiSourceCode.workingCopy(), majorChange, callback); - }, - - _clearIncrementalUpdateTimer: function() - { - if (this._incrementalUpdateTimer) - clearTimeout(this._incrementalUpdateTimer); - delete this._incrementalUpdateTimer; - }, -} - - -/** - * @constructor - * @param {WebInspector.CSSStyleModel} cssModel - */ -WebInspector.StyleContentBinding = function(cssModel) -{ - this._cssModel = cssModel; - this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this); -} - -WebInspector.StyleContentBinding.prototype = { - /** - * @param {WebInspector.UISourceCode} uiSourceCode - * @param {string} content - * @param {boolean} majorChange - * @param {function(?string)} userCallback - */ - setStyleContent: function(uiSourceCode, content, majorChange, userCallback) - { - var resource = WebInspector.resourceForURL(uiSourceCode.url); - this._cssModel.resourceBinding().requestStyleSheetIdForResource(resource, callback.bind(this)); - - /** - * @param {?CSSAgent.StyleSheetId} styleSheetId - */ - function callback(styleSheetId) - { - if (!styleSheetId) { - userCallback("No stylesheet found: " + resource.frameId + ":" + resource.url); - return; - } - - this._innerSetContent(styleSheetId, content, majorChange, userCallback, null); - } - }, - - /** - * @param {CSSAgent.StyleSheetId} styleSheetId - * @param {string} content - * @param {boolean} majorChange - * @param {function(?string)} userCallback - */ - _innerSetContent: function(styleSheetId, content, majorChange, userCallback) - { - this._isSettingContent = true; - function callback(error) - { - userCallback(error); - delete this._isSettingContent; - } - this._cssModel.setStyleSheetText(styleSheetId, content, majorChange, callback.bind(this)); - }, - - /** - * @param {WebInspector.Event} event - */ - _styleSheetChanged: function(event) - { - if (this._isSettingContent) - return; - - if (!event.data.majorChange) - return; - - /** - * @param {?string} error - * @param {string} content - */ - function callback(error, content) - { - if (!error) - this._innerStyleSheetChanged(event.data.styleSheetId, content); - } - CSSAgent.getStyleSheetText(event.data.styleSheetId, callback.bind(this)); - }, - - /** - * @param {CSSAgent.StyleSheetId} styleSheetId - * @param {string} content - */ - _innerStyleSheetChanged: function(styleSheetId, content) - { - /** - * @param {?string} styleSheetURL - */ - function callback(styleSheetURL) - { - if (typeof styleSheetURL !== "string") - return; - - var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(styleSheetURL); - if (!uiSourceCode) - return; - - if (uiSourceCode.contentType() === WebInspector.resourceTypes.Stylesheet) - uiSourceCode.addRevision(content); - } - - this._cssModel.resourceBinding().requestResourceURLForStyleSheetId(styleSheetId, callback.bind(this)); - }, -} - -/** - * @type {?WebInspector.StyleContentBinding} - */ -WebInspector.styleContentBinding = null; diff --git a/Source/WebCore/inspector/front-end/TabbedEditorContainer.js b/Source/WebCore/inspector/front-end/TabbedEditorContainer.js index d4a4e9e0a..ad0576813 100644 --- a/Source/WebCore/inspector/front-end/TabbedEditorContainer.js +++ b/Source/WebCore/inspector/front-end/TabbedEditorContainer.js @@ -212,17 +212,9 @@ WebInspector.TabbedEditorContainer.prototype = { */ removeUISourceCode: function(uiSourceCode) { - var wasCurrent = this._currentFile === uiSourceCode; - var tabId = this._tabIds.get(uiSourceCode); if (tabId) this._tabbedPane.closeTab(tabId); - - if (wasCurrent && uiSourceCode.isTemporary) { - var newUISourceCode = WebInspector.workspace.uiSourceCodeForURL(uiSourceCode.url); - if (newUISourceCode) - this._innerShowFile(newUISourceCode, false); - } }, /** @@ -327,14 +319,37 @@ WebInspector.TabbedEditorContainer.prototype = { }, /** + * @param {WebInspector.UISourceCode} oldUISourceCode + * @param {WebInspector.UISourceCode} uiSourceCode + */ + replaceFile: function(oldUISourceCode, uiSourceCode) + { + var tabId = this._tabIds.get(oldUISourceCode); + + if (!tabId) + return; + + delete this._files[this._tabIds.get(oldUISourceCode)] + this._tabIds.remove(oldUISourceCode); + this._tabIds.put(uiSourceCode, tabId); + this._files[tabId] = uiSourceCode; + + this._tabbedPane.changeTabTitle(tabId, this._titleForFile(uiSourceCode)); + this._tabbedPane.changeTabView(tabId, this._delegate.viewForFile(uiSourceCode)); + this._tabbedPane.changeTabTooltip(tabId, this._tooltipForFile(uiSourceCode)); + + this._removeUISourceCodeListeners(oldUISourceCode); + this._addUISourceCodeListeners(uiSourceCode); + }, + + /** * @param {WebInspector.UISourceCode} uiSourceCode */ _addUISourceCodeListeners: function(uiSourceCode) { uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this); uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._uiSourceCodeWorkingCopyChanged, this); - uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._uiSourceCodeWorkingCopyCommitted, this); - uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._uiSourceCodeFormattedChanged, this); + uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._uiSourceCodeContentChanged, this); }, /** @@ -344,8 +359,7 @@ WebInspector.TabbedEditorContainer.prototype = { { uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this); uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._uiSourceCodeWorkingCopyChanged, this); - uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._uiSourceCodeWorkingCopyCommitted, this); - uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._uiSourceCodeFormattedChanged, this); + uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._uiSourceCodeContentChanged, this); }, /** @@ -372,13 +386,7 @@ WebInspector.TabbedEditorContainer.prototype = { this._updateFileTitle(uiSourceCode); }, - _uiSourceCodeWorkingCopyCommitted: function(event) - { - var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.target; - this._updateFileTitle(uiSourceCode); - }, - - _uiSourceCodeFormattedChanged: function(event) + _uiSourceCodeContentChanged: function(event) { var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.target; this._updateFileTitle(uiSourceCode); @@ -408,11 +416,11 @@ WebInspector.TabbedEditorContainer.prototype = { currentFile: function() { return this._currentFile; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.TabbedEditorContainer.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {string} url @@ -447,11 +455,11 @@ WebInspector.TabbedEditorContainer.HistoryItem.prototype = { serializedHistoryItem.selectionRange = this.selectionRange; serializedHistoryItem.scrollLineNumber = this.scrollLineNumber; return serializedHistoryItem; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.TabbedEditorContainer.HistoryItem.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {Array.<WebInspector.TabbedEditorContainer.HistoryItem>} items @@ -577,7 +585,7 @@ WebInspector.TabbedEditorContainer.History.prototype = { for (var i = 0; i < this._items.length; ++i) serializedHistory.push(this._items[i].serializeToObject()); return serializedHistory; - }, - - __proto__: WebInspector.Object.prototype + } } + +WebInspector.TabbedEditorContainer.History.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/TabbedPane.js b/Source/WebCore/inspector/front-end/TabbedPane.js index 19b787fa9..3e8e8ab19 100644 --- a/Source/WebCore/inspector/front-end/TabbedPane.js +++ b/Source/WebCore/inspector/front-end/TabbedPane.js @@ -532,11 +532,11 @@ WebInspector.TabbedPane.prototype = { if (oldIndex < index) --index; this._tabs.splice(index, 0, tab); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.TabbedPane.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor diff --git a/Source/WebCore/inspector/front-end/TextEditorModel.js b/Source/WebCore/inspector/front-end/TextEditorModel.js index 6a8b2dead..068cf997b 100644 --- a/Source/WebCore/inspector/front-end/TextEditorModel.js +++ b/Source/WebCore/inspector/front-end/TextEditorModel.js @@ -528,7 +528,7 @@ WebInspector.TextEditorModel.prototype = { resetUndoStack: function() { this._undoStack = []; - }, - - __proto__: WebInspector.Object.prototype + } } + +WebInspector.TextEditorModel.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/TextPrompt.js b/Source/WebCore/inspector/front-end/TextPrompt.js index 6ca3ca58f..c40df4f0c 100644 --- a/Source/WebCore/inspector/front-end/TextPrompt.js +++ b/Source/WebCore/inspector/front-end/TextPrompt.js @@ -30,8 +30,8 @@ /** * @constructor * @extends WebInspector.Object - * @param {function(Element, Range, boolean, function(Array.<string>, number=))} completions - * @param {string=} stopCharacters + * @param {function(WebInspector.TextPrompt, Range, boolean, function(Array.<string>=))} completions + * @param {string} stopCharacters */ WebInspector.TextPrompt = function(completions, stopCharacters) { @@ -41,7 +41,7 @@ WebInspector.TextPrompt = function(completions, stopCharacters) this._proxyElement; this._proxyElementDisplay = "inline-block"; this._loadCompletions = completions; - this._completionStopCharacters = stopCharacters || " =:[({;,!+-*/&|^<>."; + this._completionStopCharacters = stopCharacters; this._suggestForceable = true; } @@ -391,7 +391,7 @@ WebInspector.TextPrompt.prototype = { var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, this._completionStopCharacters, this._element, "backward"); this._waitingForCompletions = true; - this._loadCompletions(this.proxyElement, wordPrefixRange, force, this._completionsReady.bind(this, selection, auto, wordPrefixRange, !!reverse)); + this._loadCompletions(this, wordPrefixRange, force, this._completionsReady.bind(this, selection, auto, wordPrefixRange, !!reverse)); }, _boxForAnchorAtStart: function(selection, textRange) @@ -433,9 +433,8 @@ WebInspector.TextPrompt.prototype = { * @param {Range} originalWordPrefixRange * @param {boolean} reverse * @param {Array.<string>=} completions - * @param {number=} selectedIndex */ - _completionsReady: function(selection, auto, originalWordPrefixRange, reverse, completions, selectedIndex) + _completionsReady: function(selection, auto, originalWordPrefixRange, reverse, completions) { if (!this._waitingForCompletions || !completions || !completions.length) { this.hideSuggestBox(); @@ -452,31 +451,29 @@ WebInspector.TextPrompt.prototype = { if (originalWordPrefixRange.toString() + selectionRange.toString() != fullWordRange.toString()) return; - selectedIndex = selectedIndex || 0; - this._userEnteredRange = fullWordRange; this._userEnteredText = fullWordRange.toString(); if (this._suggestBox) - this._suggestBox.updateSuggestions(this._boxForAnchorAtStart(selection, fullWordRange), completions, selectedIndex, !this.isCaretAtEndOfPrompt()); + this._suggestBox.updateSuggestions(this._boxForAnchorAtStart(selection, fullWordRange), completions, !this.isCaretAtEndOfPrompt()); var wordPrefixLength = originalWordPrefixRange.toString().length; if (auto) { - var completionText = completions[selectedIndex]; + var completionText = completions[0]; var commonPrefix = this._buildCommonPrefix(completions, wordPrefixLength); this._commonPrefix = commonPrefix; } else { if (completions.length === 1) { - var completionText = completions[selectedIndex]; + var completionText = completions[0]; wordPrefixLength = completionText.length; } else { var commonPrefix = this._buildCommonPrefix(completions, wordPrefixLength); wordPrefixLength = commonPrefix.length; if (selection.isCollapsed) - var completionText = completions[selectedIndex]; + var completionText = completions[0]; else { var currentText = fullWordRange.toString(); @@ -488,7 +485,7 @@ WebInspector.TextPrompt.prototype = { var nextIndex = foundIndex + (reverse ? -1 : 1); if (foundIndex === null || nextIndex >= completions.length) - var completionText = completions[selectedIndex]; + var completionText = completions[0]; else if (nextIndex < 0) var completionText = completions[completions.length - 1]; else @@ -753,16 +750,15 @@ WebInspector.TextPrompt.prototype = { return false; }, - - __proto__: WebInspector.Object.prototype } +WebInspector.TextPrompt.prototype.__proto__ = WebInspector.Object.prototype; /** * @constructor * @extends {WebInspector.TextPrompt} - * @param {function(Element, Range, boolean, function(Array.<string>,number=))} completions - * @param {string=} stopCharacters + * @param {function(WebInspector.TextPrompt, Range, boolean, function(Array.<string>=))} completions + * @param {string} stopCharacters */ WebInspector.TextPromptWithHistory = function(completions, stopCharacters) { @@ -921,11 +917,11 @@ WebInspector.TextPromptWithHistory.prototype = { } return WebInspector.TextPrompt.prototype.defaultKeyHandler.apply(this, arguments); - }, - - __proto__: WebInspector.TextPrompt.prototype + } } +WebInspector.TextPromptWithHistory.prototype.__proto__ = WebInspector.TextPrompt.prototype; + /** * @constructor */ @@ -933,8 +929,6 @@ WebInspector.TextPrompt.SuggestBox = function(textPrompt, inputElement, classNam { this._textPrompt = textPrompt; this._inputElement = inputElement; - this._length = 0; - this._selectedIndex = -1; this._selectedElement = null; this._boundOnScroll = this._onscrollresize.bind(this, true); this._boundOnResize = this._onscrollresize.bind(this, false); @@ -1078,24 +1072,60 @@ WebInspector.TextPrompt.SuggestBox.prototype = { return true; }, - /** - * @param {number} shift - * @param {boolean=} isCircular - * @return {boolean} is changed - */ - _selectClosest: function(shift, isCircular) + _onNextItem: function(event, isPageScroll) { - if (!this._length) + var children = this.contentElement.childNodes; + if (!children.length) return false; - var index = this._selectedIndex + shift; + if (!this._selectedElement) + this._selectedElement = this.contentElement.firstChild; + else { + if (!isPageScroll) + this._selectedElement = this._selectedElement.nextSibling || this.contentElement.firstChild; + else { + var candidate = this._selectedElement; + + for (var itemsLeft = this._rowCountPerViewport; itemsLeft; --itemsLeft) { + if (candidate.nextSibling) + candidate = candidate.nextSibling; + else + break; + } - if (isCircular) - index = (this._length + index) % this._length; - else - index = Number.constrain(index, 0, this._length - 1); + this._selectedElement = candidate; + } + } + this._updateSelection(); + this._applySuggestion(undefined, true); + return true; + }, - this._selectItem(index); + _onPreviousItem: function(event, isPageScroll) + { + var children = this.contentElement.childNodes; + if (!children.length) + return false; + + if (!this._selectedElement) + this._selectedElement = this.contentElement.lastChild; + else { + if (!isPageScroll) + this._selectedElement = this._selectedElement.previousSibling || this.contentElement.lastChild; + else { + var candidate = this._selectedElement; + + for (var itemsLeft = this._rowCountPerViewport; itemsLeft; --itemsLeft) { + if (candidate.previousSibling) + candidate = candidate.previousSibling; + else + break; + } + + this._selectedElement = candidate; + } + } + this._updateSelection(); this._applySuggestion(undefined, true); return true; }, @@ -1103,16 +1133,15 @@ WebInspector.TextPrompt.SuggestBox.prototype = { /** * @param {AnchorBox} anchorBox * @param {Array.<string>=} completions - * @param {number=} selectedIndex * @param {boolean=} canShowForSingleItem */ - updateSuggestions: function(anchorBox, completions, selectedIndex, canShowForSingleItem) + updateSuggestions: function(anchorBox, completions, canShowForSingleItem) { if (this._suggestTimeout) { clearTimeout(this._suggestTimeout); delete this._suggestTimeout; } - this._completionsReady(anchorBox, completions, selectedIndex, canShowForSingleItem); + this._completionsReady(anchorBox, completions, canShowForSingleItem); }, _onItemMouseDown: function(text, event) @@ -1140,12 +1169,10 @@ WebInspector.TextPrompt.SuggestBox.prototype = { }, /** - * @param {Array.<string>=} items - * @param {number=} selectedIndex + * @param {boolean=} canShowForSingleItem */ - _updateItems: function(items, selectedIndex) + _updateItems: function(items, canShowForSingleItem) { - this._length = items.length; this.contentElement.removeChildren(); var userEnteredText = this._textPrompt._userEnteredText; @@ -1155,24 +1182,21 @@ WebInspector.TextPrompt.SuggestBox.prototype = { this.contentElement.appendChild(currentItemElement); } - this._selectedElement = null; - if (typeof selectedIndex === "number") - this._selectItem(selectedIndex); + this._selectedElement = canShowForSingleItem ? this.contentElement.firstChild : null; + this._updateSelection(); }, - /** - * @param {number} index - */ - _selectItem: function(index) + _updateSelection: function() { - if (this._selectedElement) - this._selectedElement.classList.remove("selected"); - - this._selectedIndex = index; - this._selectedElement = this.contentElement.children[index]; - this._selectedElement.classList.add("selected"); - - this._selectedElement.scrollIntoViewIfNeeded(false); + // FIXME: might want some optimization if becomes a bottleneck. + for (var child = this.contentElement.firstChild; child; child = child.nextSibling) { + if (child !== this._selectedElement) + child.removeStyleClass("selected"); + } + if (this._selectedElement) { + this._selectedElement.addStyleClass("selected"); + this._selectedElement.scrollIntoViewIfNeeded(false); + } }, /** @@ -1202,13 +1226,12 @@ WebInspector.TextPrompt.SuggestBox.prototype = { /** * @param {AnchorBox} anchorBox * @param {Array.<string>=} completions - * @param {number=} selectedIndex * @param {boolean=} canShowForSingleItem */ - _completionsReady: function(anchorBox, completions, selectedIndex, canShowForSingleItem) + _completionsReady: function(anchorBox, completions, canShowForSingleItem) { if (this._canShowBox(completions, canShowForSingleItem)) { - this._updateItems(completions, selectedIndex); + this._updateItems(completions, canShowForSingleItem); this._updateBoxPosition(anchorBox); if (!this.visible) this._bodyElement.appendChild(this._element); @@ -1219,22 +1242,22 @@ WebInspector.TextPrompt.SuggestBox.prototype = { upKeyPressed: function(event) { - return this._selectClosest(-1, true); + return this._onPreviousItem(event, false); }, downKeyPressed: function(event) { - return this._selectClosest(1, true); + return this._onNextItem(event, false); }, pageUpKeyPressed: function(event) { - return this._selectClosest(-this._rowCountPerViewport, false); + return this._onPreviousItem(event, true); }, pageDownKeyPressed: function(event) { - return this._selectClosest(this._rowCountPerViewport, false); + return this._onNextItem(event, true); }, enterKeyPressed: function(event) diff --git a/Source/WebCore/inspector/front-end/TimelineManager.js b/Source/WebCore/inspector/front-end/TimelineManager.js index afadc059f..4e7e5d26d 100644 --- a/Source/WebCore/inspector/front-end/TimelineManager.js +++ b/Source/WebCore/inspector/front-end/TimelineManager.js @@ -75,11 +75,11 @@ WebInspector.TimelineManager.prototype = { _stopped: function() { this.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStopped); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.TimelineManager.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {TimelineAgent.Dispatcher} diff --git a/Source/WebCore/inspector/front-end/TimelineModel.js b/Source/WebCore/inspector/front-end/TimelineModel.js index 5d9d4c96c..deecb6e7d 100644 --- a/Source/WebCore/inspector/front-end/TimelineModel.js +++ b/Source/WebCore/inspector/front-end/TimelineModel.js @@ -247,11 +247,11 @@ WebInspector.TimelineModel.prototype = { recordOffsetInSeconds: function(rawRecord) { return WebInspector.TimelineModel.startTimeInSeconds(rawRecord) - this._minimumRecordTime; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.TimelineModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {WebInspector.OutputStream} @@ -330,14 +330,11 @@ WebInspector.TimelineModelLoadFromFileDelegate = function(model, progress) } WebInspector.TimelineModelLoadFromFileDelegate.prototype = { - onTransferStarted: function() + onTransferStarted: function(reader) { this._progress.setTitle(WebInspector.UIString("Loading\u2026")); }, - /** - * @param {WebInspector.ChunkedReader} reader - */ onChunkTransferred: function(reader) { if (this._progress.isCanceled()) { @@ -354,14 +351,11 @@ WebInspector.TimelineModelLoadFromFileDelegate.prototype = { } }, - onTransferFinished: function() + onTransferFinished: function(reader) { this._progress.done(); }, - /** - * @param {WebInspector.ChunkedReader} reader - */ onError: function(reader, event) { this._progress.done(); diff --git a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js index 5c8ddc77c..ecdfa820f 100644 --- a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js +++ b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js @@ -347,11 +347,11 @@ WebInspector.TimelineOverviewPane.prototype = { if (!this.isShowing()) return; this._refreshTimeout = setTimeout(this._update.bind(this), 300); - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.TimelineOverviewPane.prototype.__proto__ = WebInspector.View.prototype; + /** * @constructor * @extends {WebInspector.Object} @@ -625,11 +625,11 @@ WebInspector.TimelineOverviewWindow.prototype = { left = Math.max(0, Math.min(max - delta, referencePoint + (left - referencePoint) * factor)); right = Math.min(max, left + delta); this._setWindowPosition(left, right); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.TimelineOverviewWindow.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor */ @@ -1219,11 +1219,11 @@ WebInspector.TimelineFrameOverview.prototype = { startTime: firstBar >= this._barTimes.length ? Infinity : this._barTimes[firstBar].startTime, endTime: rightOffset + snapToRightTolerancePixels > windowSpan ? Infinity : this._barTimes[lastBar].endTime } - }, - - __proto__: WebInspector.View.prototype + } } +WebInspector.TimelineFrameOverview.prototype.__proto__ = WebInspector.View.prototype; + /** * @param {WebInspector.TimelineOverviewPane} pane * @constructor diff --git a/Source/WebCore/inspector/front-end/TimelinePanel.js b/Source/WebCore/inspector/front-end/TimelinePanel.js index 50f4b6ada..4ccb7a42c 100644 --- a/Source/WebCore/inspector/front-end/TimelinePanel.js +++ b/Source/WebCore/inspector/front-end/TimelinePanel.js @@ -1153,11 +1153,11 @@ WebInspector.TimelinePanel.prototype = { this._searchRegExp = createPlainTextSearchRegex(searchQuery, "i"); delete this._searchResults; this._updateSearchHighlight(true); - }, - - __proto__: WebInspector.Panel.prototype + } } +WebInspector.TimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype; + /** * @constructor * @param {WebInspector.TimelineModel} model diff --git a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js index baa1a1c8d..8065f5fa0 100644 --- a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js +++ b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js @@ -439,11 +439,11 @@ WebInspector.TimelinePresentationModel.prototype = { return false; } return true; - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.TimelinePresentationModel.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @param {WebInspector.TimelinePresentationModel} presentationModel @@ -1166,7 +1166,7 @@ WebInspector.TimelineCategory.prototype = { { this._hidden = hidden; this.dispatchEventToListeners(WebInspector.TimelineCategory.Events.VisibilityChanged, this); - }, - - __proto__: WebInspector.Object.prototype + } } + +WebInspector.TimelineCategory.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/Toolbar.js b/Source/WebCore/inspector/front-end/Toolbar.js index 5756e73d7..9b8995c38 100644 --- a/Source/WebCore/inspector/front-end/Toolbar.js +++ b/Source/WebCore/inspector/front-end/Toolbar.js @@ -35,7 +35,7 @@ WebInspector.Toolbar = function() { this.element = document.getElementById("toolbar"); - WebInspector.installDragHandle(this.element, this._toolbarDragStart.bind(this), this._toolbarDrag.bind(this), this._toolbarDragEnd.bind(this), "default"); + WebInspector.installDragHandle(this.element, this._toolbarDragStart.bind(this), this._toolbarDrag.bind(this), this._toolbarDragEnd.bind(this), (WebInspector.isCompactMode() ? "row-resize" : "default")); this._dropdownButton = document.getElementById("toolbar-dropdown-arrow"); this._dropdownButton.addEventListener("click", this._toggleDropdown.bind(this), false); @@ -97,19 +97,11 @@ WebInspector.Toolbar.prototype = { }, /** - * @param {boolean} isCompactMode - */ - setCompactMode: function(isCompactMode) - { - this._isCompactMode = isCompactMode; - }, - - /** * @return {boolean} */ _toolbarDragStart: function(event) { - if ((!this._isCompactMode && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port() == "qt") + if ((!WebInspector.isCompactMode() && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port() == "qt") return false; var target = event.target; @@ -132,7 +124,7 @@ WebInspector.Toolbar.prototype = { _toolbarDrag: function(event) { - if (this._isCompactMode) { + if (WebInspector.isCompactMode()) { var height = window.innerHeight - (event.screenY - this.element.lastScreenY); InspectorFrontendHost.setAttachedWindowHeight(height); diff --git a/Source/WebCore/inspector/front-end/TopDownProfileDataGridTree.js b/Source/WebCore/inspector/front-end/TopDownProfileDataGridTree.js index 7dbadab2c..cbec51a60 100644 --- a/Source/WebCore/inspector/front-end/TopDownProfileDataGridTree.js +++ b/Source/WebCore/inspector/front-end/TopDownProfileDataGridTree.js @@ -65,11 +65,11 @@ WebInspector.TopDownProfileDataGridNode.prototype = { if (child) this._merge(child, true); - }, - - __proto__: WebInspector.ProfileDataGridNode.prototype + } } +WebInspector.TopDownProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype; + /** * @constructor * @extends {WebInspector.ProfileDataGridTree} @@ -127,7 +127,7 @@ WebInspector.TopDownProfileDataGridTree.prototype = { _merge: WebInspector.TopDownProfileDataGridNode.prototype._merge, - _sharedPopulate: WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate, - - __proto__: WebInspector.ProfileDataGridTree.prototype + _sharedPopulate: WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate } + +WebInspector.TopDownProfileDataGridTree.prototype.__proto__ = WebInspector.ProfileDataGridTree.prototype; diff --git a/Source/WebCore/inspector/front-end/UISourceCode.js b/Source/WebCore/inspector/front-end/UISourceCode.js index 2bb0e1bd2..47c8c3425 100644 --- a/Source/WebCore/inspector/front-end/UISourceCode.js +++ b/Source/WebCore/inspector/front-end/UISourceCode.js @@ -34,15 +34,15 @@ * @extends {WebInspector.Object} * @implements {WebInspector.ContentProvider} * @param {string} url + * @param {WebInspector.Resource} resource * @param {WebInspector.ContentProvider} contentProvider - * @param {boolean} isEditable */ -WebInspector.UISourceCode = function(url, contentProvider, isEditable) +WebInspector.UISourceCode = function(url, resource, contentProvider) { this._url = url; + this._resource = resource; this._parsedURL = new WebInspector.ParsedURL(url); this._contentProvider = contentProvider; - this._isEditable = isEditable; this.isContentScript = false; /** * @type Array.<function(?string,boolean,string)> @@ -61,15 +61,13 @@ WebInspector.UISourceCode = function(url, contentProvider, isEditable) * @type {Array.<WebInspector.Revision>} */ this.history = []; - if (this.isEditable()) - this._restoreRevisionHistory(); + this._restoreRevisionHistory(); this._formatterMapping = new WebInspector.IdentityFormatterSourceMapping(); } WebInspector.UISourceCode.Events = { - FormattedChanged: "FormattedChanged", + ContentChanged: "ContentChanged", WorkingCopyChanged: "WorkingCopyChanged", - WorkingCopyCommitted: "WorkingCopyCommitted", TitleChanged: "TitleChanged", ConsoleMessageAdded: "ConsoleMessageAdded", ConsoleMessageRemoved: "ConsoleMessageRemoved", @@ -96,6 +94,14 @@ WebInspector.UISourceCode.prototype = { }, /** + * @return {WebInspector.Resource} + */ + resource: function() + { + return this._resource; + }, + + /** * @return {WebInspector.ParsedURL} */ get parsedURL() @@ -104,7 +110,7 @@ WebInspector.UISourceCode.prototype = { }, /** - * @return {string} + * @return {?string} */ contentURL: function() { @@ -120,38 +126,6 @@ WebInspector.UISourceCode.prototype = { }, /** - * @return {WebInspector.ScriptFile} - */ - scriptFile: function() - { - return this._scriptFile; - }, - - /** - * @param {WebInspector.ScriptFile} scriptFile - */ - setScriptFile: function(scriptFile) - { - this._scriptFile = scriptFile; - }, - - /** - * @return {WebInspector.StyleFile} - */ - styleFile: function() - { - return this._styleFile; - }, - - /** - * @param {WebInspector.StyleFile} styleFile - */ - setStyleFile: function(styleFile) - { - this._styleFile = styleFile; - }, - - /** * @param {function(?string,boolean,string)} callback */ requestContent: function(callback) @@ -174,32 +148,33 @@ WebInspector.UISourceCode.prototype = { }, /** - * @param {string} content + * @param {string} newContent */ - _commitContent: function(content) + _setContent: function(newContent) { - this._content = content; - this._contentLoaded = true; - - var lastRevision = this.history.length ? this.history[this.history.length - 1] : null; - if (!lastRevision || lastRevision._content !== this._content) { - var revision = new WebInspector.Revision(this, this._content, new Date()); - this.history.push(revision); - revision._persist(); - } - - var oldWorkingCopy = this._workingCopy; - delete this._workingCopy; - this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted, {oldWorkingCopy: oldWorkingCopy, workingCopy: this.workingCopy()}); - WebInspector.workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: this, content: this._content }); + this.setWorkingCopy(newContent); + this.commitWorkingCopy(function() {}); }, /** * @param {string} content + * @param {Date=} timestamp + * @param {boolean=} restoringHistory */ - addRevision: function(content) + addRevision: function(content, timestamp, restoringHistory) { - this._commitContent(content); + if (this.history.length) { + var lastRevision = this.history[this.history.length - 1]; + if (lastRevision._content === content) + return; + } + var revision = new WebInspector.Revision(this, content, timestamp || new Date()); + this.history.push(revision); + + this.contentChanged(revision.content || "", this.canonicalMimeType()); + if (!restoringHistory) + revision._persist(); + WebInspector.workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: this, content: content }); }, _restoreRevisionHistory: function() @@ -209,17 +184,8 @@ WebInspector.UISourceCode.prototype = { var registry = WebInspector.Revision._revisionHistoryRegistry(); var historyItems = registry[this.url]; - if (!historyItems || !historyItems.length) - return; - for (var i = 0; i < historyItems.length; ++i) { - var content = window.localStorage[historyItems[i].key]; - var timestamp = new Date(historyItems[i].timestamp); - var revision = new WebInspector.Revision(this, content, timestamp); - this.history.push(revision); - } - this._content = this.history[this.history.length - 1].content; - this._contentLoaded = true; - this._mimeType = this.canonicalMimeType(); + for (var i = 0; historyItems && i < historyItems.length; ++i) + this.addRevision(window.localStorage[historyItems[i].key], new Date(historyItems[i].timestamp), true); }, _clearRevisionHistory: function() @@ -238,53 +204,50 @@ WebInspector.UISourceCode.prototype = { revertToOriginal: function() { /** - * @this {WebInspector.UISourceCode} * @param {?string} content * @param {boolean} contentEncoded * @param {string} mimeType */ - function callback(content, contentEncoded, mimeType) + function callback(content, contentEncoded, mimeType) { - if (typeof content !== "string") - return; - - this.addRevision(content); + this._setContent(); } this.requestOriginalContent(callback.bind(this)); }, - /** - * @param {function(WebInspector.UISourceCode)} callback - */ revertAndClearHistory: function(callback) { - /** - * @this {WebInspector.UISourceCode} - * @param {?string} content - * @param {boolean} contentEncoded - * @param {string} mimeType - */ - function revert(content, contentEncoded, mimeType) + function revert(content) { - if (typeof content !== "string") - return; - - this.addRevision(content); + this._setContent(content); this._clearRevisionHistory(); this.history = []; - callback(this); + callback(); } this.requestOriginalContent(revert.bind(this)); }, /** + * @param {string} newContent + * @param {string} mimeType + */ + contentChanged: function(newContent, mimeType) + { + this._content = newContent; + this._mimeType = mimeType; + this._contentLoaded = true; + delete this._workingCopy; + this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ContentChanged, {content: newContent}); + }, + + /** * @return {boolean} */ isEditable: function() { - return this._isEditable; + return false; }, /** @@ -302,17 +265,18 @@ WebInspector.UISourceCode.prototype = { */ setWorkingCopy: function(newWorkingCopy) { - this._mimeType = this.canonicalMimeType(); var oldWorkingCopy = this._workingCopy; if (this._content === newWorkingCopy) delete this._workingCopy; else this._workingCopy = newWorkingCopy; - if (this.scriptFile()) - this.scriptFile().workingCopyChanged(); - else if (this.styleFile()) - this.styleFile().workingCopyChanged(); - this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged, {oldWorkingCopy: oldWorkingCopy, workingCopy: this.workingCopy()}); + this.workingCopyChanged(); + this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged, {oldWorkingCopy: oldWorkingCopy, workingCopy: newWorkingCopy}); + }, + + workingCopyChanged: function() + { + // Overridden. }, /** @@ -325,11 +289,17 @@ WebInspector.UISourceCode.prototype = { return; } - if (this.scriptFile()) - this.scriptFile().workingCopyCommitted(callback); - else if (this.styleFile()) - this.styleFile().workingCopyCommitted(callback); - this._commitContent(this._workingCopy); + var newContent = this._workingCopy; + this.workingCopyCommitted(callback); + this.addRevision(newContent); + }, + + /** + * @param {function(?string)} callback + */ + workingCopyCommitted: function(callback) + { + // Overridden. }, /** @@ -372,9 +342,7 @@ WebInspector.UISourceCode.prototype = { */ searchInContent: function(query, caseSensitive, isRegex, callback) { - var content = this.content(); - var provider = content ? new WebInspector.StaticContentProvider(this._contentProvider.contentType(), content) : this._contentProvider; - provider.searchInContent(query, caseSensitive, isRegex, callback); + this._contentProvider.searchInContent(query, caseSensitive, isRegex, callback); }, /** @@ -394,16 +362,8 @@ WebInspector.UISourceCode.prototype = { callbacks[i](content, contentEncoded, mimeType); if (this._formatOnLoad) { - function formattedCallback() - { - for (var i = 0; i < this._pendingFormattedCallbacks.length; ++i) - this._pendingFormattedCallbacks[i](); - delete this._pendingFormattedCallbacks; - - } - delete this._formatOnLoad; - this.setFormatted(true, formattedCallback.bind(this)); + this.setFormatted(true); } }, @@ -507,7 +467,7 @@ WebInspector.UISourceCode.prototype = { */ formatted: function() { - return !!this._formatted; + return this._formatted; }, /** @@ -518,10 +478,8 @@ WebInspector.UISourceCode.prototype = { { callback = callback || function() {}; if (!this.contentLoaded()) { - if (!this._pendingFormattedCallbacks) - this._pendingFormattedCallbacks = []; - this._pendingFormattedCallbacks.push(callback); this._formatOnLoad = formatted; + callback(); return; } @@ -560,12 +518,11 @@ WebInspector.UISourceCode.prototype = { function formattedChanged(content, formatterMapping) { this._togglingFormatter = true; - this._content = content; - delete this._workingCopy; - this.dispatchEventToListeners(WebInspector.UISourceCode.Events.FormattedChanged, {content: content}); + this.contentChanged(content, mimeType); delete this._togglingFormatter; this._formatterMapping = formatterMapping; this.updateLiveLocations(); + this.formattedChanged(); callback(); } } @@ -588,9 +545,13 @@ WebInspector.UISourceCode.prototype = { this._sourceMapping = sourceMapping; }, - __proto__: WebInspector.Object.prototype + formattedChanged: function() + { + } } +WebInspector.UISourceCode.prototype.__proto__ = WebInspector.Object.prototype; + /** * @interface */ @@ -600,8 +561,7 @@ WebInspector.UISourceCodeProvider = function() WebInspector.UISourceCodeProvider.Events = { UISourceCodeAdded: "UISourceCodeAdded", - TemporaryUISourceCodeAdded: "TemporaryUISourceCodeAdded", - TemporaryUISourceCodeRemoved: "TemporaryUISourceCodeRemoved", + UISourceCodeReplaced: "UISourceCodeReplaced", UISourceCodeRemoved: "UISourceCodeRemoved" } @@ -806,13 +766,13 @@ WebInspector.Revision.prototype = { function revert(content) { if (this._uiSourceCode._content !== content) - this._uiSourceCode.addRevision(content); + this._uiSourceCode._setContent(content); } this.requestContent(revert.bind(this)); }, /** - * @return {string} + * @return {?string} */ contentURL: function() { diff --git a/Source/WebCore/inspector/front-end/UISourceCodeFrame.js b/Source/WebCore/inspector/front-end/UISourceCodeFrame.js index 7e0bf51cd..e93b4f8a7 100644 --- a/Source/WebCore/inspector/front-end/UISourceCodeFrame.js +++ b/Source/WebCore/inspector/front-end/UISourceCodeFrame.js @@ -35,9 +35,7 @@ WebInspector.UISourceCodeFrame = function(uiSourceCode) { this._uiSourceCode = uiSourceCode; WebInspector.SourceFrame.call(this, this._uiSourceCode); - this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.FormattedChanged, this._onFormattedChanged, this); - this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._onWorkingCopyChanged, this); - this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyCommitted, this); + this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._onContentChanged, this); } WebInspector.UISourceCodeFrame.prototype = { @@ -64,9 +62,7 @@ WebInspector.UISourceCodeFrame.prototype = { onTextChanged: function(oldRange, newRange) { - this._isSettingWorkingCopy = true; this._uiSourceCode.setWorkingCopy(this._textEditor.text()); - delete this._isSettingWorkingCopy; }, _didEditContent: function(error) @@ -80,34 +76,10 @@ WebInspector.UISourceCodeFrame.prototype = { /** * @param {WebInspector.Event} event */ - _onFormattedChanged: function(event) + _onContentChanged: function(event) { - var content = /** @type {string} */ event.data.content; - this._innerSetContent(content); - }, - - /** - * @param {WebInspector.Event} event - */ - _onWorkingCopyChanged: function(event) - { - this._innerSetContent(this._uiSourceCode.workingCopy()); - }, - - /** - * @param {WebInspector.Event} event - */ - _onWorkingCopyCommitted: function(event) - { - this._innerSetContent(this._uiSourceCode.workingCopy()); - }, - - _innerSetContent: function(content) - { - if (this._isSettingWorkingCopy || this._isCommittingEditing) - return; - - this.setContent(this._uiSourceCode.content() || "", false, this._uiSourceCode.contentType().canonicalMimeType()); + if (!this._isCommittingEditing) + this.setContent(this._uiSourceCode.content() || "", false, this._uiSourceCode.contentType().canonicalMimeType()); }, populateTextAreaContextMenu: function(contextMenu, lineNumber) @@ -115,7 +87,7 @@ WebInspector.UISourceCodeFrame.prototype = { WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber); contextMenu.appendApplicableItems(this._uiSourceCode); contextMenu.appendSeparator(); - }, - - __proto__: WebInspector.SourceFrame.prototype + } } + +WebInspector.UISourceCodeFrame.prototype.__proto__ = WebInspector.SourceFrame.prototype; diff --git a/Source/WebCore/inspector/front-end/UserAgentSupport.js b/Source/WebCore/inspector/front-end/UserAgentSupport.js index b3edc6677..ebed8079c 100644 --- a/Source/WebCore/inspector/front-end/UserAgentSupport.js +++ b/Source/WebCore/inspector/front-end/UserAgentSupport.js @@ -362,8 +362,3 @@ WebInspector.UserAgentSupport.prototype = { } } - -/** - * @type {WebInspector.UserAgentSupport} - */ -WebInspector.userAgentSupport; diff --git a/Source/WebCore/inspector/front-end/View.js b/Source/WebCore/inspector/front-end/View.js index d3adff99b..91cb287c0 100644 --- a/Source/WebCore/inspector/front-end/View.js +++ b/Source/WebCore/inspector/front-end/View.js @@ -358,11 +358,11 @@ WebInspector.View.prototype = { return; WebInspector.setCurrentFocusElement(element); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.View.prototype.__proto__ = WebInspector.Object.prototype; + WebInspector.View._originalAppendChild = Element.prototype.appendChild; WebInspector.View._originalInsertBefore = Element.prototype.insertBefore; WebInspector.View._originalRemoveChild = Element.prototype.removeChild; diff --git a/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js b/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js index 7aa9e5572..caed4f988 100644 --- a/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js +++ b/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js @@ -110,11 +110,11 @@ WebInspector.WatchExpressionsSidebarPane.prototype = { { event.consume(); this.refreshExpressions(); - }, - - __proto__: WebInspector.SidebarPane.prototype + } } +WebInspector.WatchExpressionsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + /** * @constructor * @extends {WebInspector.ObjectPropertiesSection} @@ -206,7 +206,7 @@ WebInspector.WatchExpressionsSection.prototype = { if (!expression) continue; - WebInspector.runtimeModel.evaluate(expression, this._watchObjectGroupId, false, true, false, appendResult.bind(this, expression, i)); + WebInspector.consoleView.evalInInspectedWindow(expression, this._watchObjectGroupId, false, true, false, appendResult.bind(this, expression, i)); } if (!propertyCount) { @@ -320,11 +320,11 @@ WebInspector.WatchExpressionsSection.prototype = { } this._lastMouseMovePageY = pageY; - }, - - __proto__: WebInspector.ObjectPropertiesSection.prototype + } } +WebInspector.WatchExpressionsSection.prototype.__proto__ = WebInspector.ObjectPropertiesSection.prototype; + WebInspector.WatchExpressionsSection.CompareProperties = function(propertyA, propertyB) { if (propertyA.watchIndex == propertyB.watchIndex) @@ -411,7 +411,7 @@ WebInspector.WatchExpressionTreeElement.prototype = { this.property.name = expression; this.treeOutline.section.updateExpression(this, expression); - }, - - __proto__: WebInspector.ObjectPropertyTreeElement.prototype + } } + +WebInspector.WatchExpressionTreeElement.prototype.__proto__ = WebInspector.ObjectPropertyTreeElement.prototype; diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index f657de7af..ac64947a3 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -58,7 +58,6 @@ <file>DOMStorage.js</file> <file>DOMStorageItemsView.js</file> <file>DOMSyntaxHighlighter.js</file> - <file>DockController.js</file> <file>Drawer.js</file> <file>ElementsPanel.js</file> <file>ElementsPanelDescriptor.js</file> @@ -129,8 +128,7 @@ <file>ProfileDataGridTree.js</file> <file>ProfileLauncherView.js</file> <file>ProfilesPanel.js</file> - <file>Progress.js</file> - <file>ProgressIndicator.js</file> + <file>ProgressBar.js</file> <file>PropertiesSection.js</file> <file>PropertiesSidebarPane.js</file> <file>RemoteObject.js</file> diff --git a/Source/WebCore/inspector/front-end/WorkerManager.js b/Source/WebCore/inspector/front-end/WorkerManager.js index 149e88123..9d14da9b9 100644 --- a/Source/WebCore/inspector/front-end/WorkerManager.js +++ b/Source/WebCore/inspector/front-end/WorkerManager.js @@ -219,11 +219,11 @@ WebInspector.WorkerManager.prototype = { var screen = new WebInspector.WorkerTerminatedScreen(); WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, screen.hide, screen); screen.showModal(); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.WorkerManager.prototype.__proto__ = WebInspector.Object.prototype; + /** * @constructor * @implements {WorkerAgent.Dispatcher} @@ -287,7 +287,7 @@ WebInspector.WorkerTerminatedScreen.prototype = { { WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this.hide, this); WebInspector.HelpScreen.prototype.willHide.call(this); - }, - - __proto__: WebInspector.HelpScreen.prototype + } } + +WebInspector.WorkerTerminatedScreen.prototype.__proto__ = WebInspector.HelpScreen.prototype; diff --git a/Source/WebCore/inspector/front-end/WorkersSidebarPane.js b/Source/WebCore/inspector/front-end/WorkersSidebarPane.js index 3e344680c..efa592161 100644 --- a/Source/WebCore/inspector/front-end/WorkersSidebarPane.js +++ b/Source/WebCore/inspector/front-end/WorkersSidebarPane.js @@ -118,7 +118,7 @@ WebInspector.WorkersSidebarPane.prototype = { _autoattachToWorkersClicked: function(event) { WorkerAgent.setAutoconnectToWorkers(event.target.checked); - }, - - __proto__: WebInspector.SidebarPane.prototype + } } + +WebInspector.WorkersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/Source/WebCore/inspector/front-end/Workspace.js b/Source/WebCore/inspector/front-end/Workspace.js index 6fcca5a1a..05087c8d5 100644 --- a/Source/WebCore/inspector/front-end/Workspace.js +++ b/Source/WebCore/inspector/front-end/Workspace.js @@ -35,7 +35,6 @@ WebInspector.WorkspaceController = function(workspace) { this._workspace = workspace; WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded, this._frameAdded, this); } WebInspector.WorkspaceController.prototype = { @@ -45,13 +44,6 @@ WebInspector.WorkspaceController.prototype = { this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectWillReset, this._workspace.project()); this._workspace.project().reset(); this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectDidReset, this._workspace.project()); - }, - - _frameAdded: function(event) - { - var frame = /** @type {WebInspector.ResourceTreeFrame} */ event.data; - if (frame.isMainFrame()) - WebInspector.Revision.filterOutStaleRevisions(); } } @@ -85,11 +77,16 @@ WebInspector.Project.prototype = { }, /** + * @param {WebInspector.UISourceCode} oldUISourceCode * @param {WebInspector.UISourceCode} uiSourceCode */ - addTemporaryUISourceCode: function(uiSourceCode) + replaceUISourceCode: function(oldUISourceCode, uiSourceCode) { - this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeAdded, uiSourceCode); + this._uiSourceCodes.splice(this._uiSourceCodes.indexOf(oldUISourceCode), 1); + if (this._uiSourceCodes.indexOf(uiSourceCode) === -1) + this._uiSourceCodes.push(uiSourceCode); + var data = { oldUISourceCode: oldUISourceCode, uiSourceCode: uiSourceCode }; + this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, data); }, /** @@ -102,14 +99,6 @@ WebInspector.Project.prototype = { }, /** - * @param {WebInspector.UISourceCode} uiSourceCode - */ - removeTemporaryUISourceCode: function(uiSourceCode) - { - this._workspace.dispatchEventToListeners(WebInspector.UISourceCodeProvider.Events.TemporaryUISourceCodeRemoved, uiSourceCode); - }, - - /** * @param {string} url * @return {?WebInspector.UISourceCode} */ @@ -172,11 +161,11 @@ WebInspector.Workspace.prototype = { uiSourceCodes: function() { return this._project.uiSourceCodes(); - }, - - __proto__: WebInspector.Object.prototype + } } +WebInspector.Workspace.prototype.__proto__ = WebInspector.Object.prototype; + /** * @type {?WebInspector.Workspace} */ diff --git a/Source/WebCore/inspector/front-end/elementsPanel.css b/Source/WebCore/inspector/front-end/elementsPanel.css index dc2344762..568fd405f 100644 --- a/Source/WebCore/inspector/front-end/elementsPanel.css +++ b/Source/WebCore/inspector/front-end/elementsPanel.css @@ -33,7 +33,6 @@ #elements-content > ol { display: inline-block; - min-height: 100%; } #elements-content .editing { diff --git a/Source/WebCore/inspector/front-end/externs.js b/Source/WebCore/inspector/front-end/externs.js index ba5bbc9fe..21d61a00a 100644 --- a/Source/WebCore/inspector/front-end/externs.js +++ b/Source/WebCore/inspector/front-end/externs.js @@ -110,8 +110,7 @@ DOMApplicationCache.prototype.DOWNLOADING = 3; DOMApplicationCache.prototype.UPDATEREADY = 4; DOMApplicationCache.prototype.OBSOLETE = 5; -/** @type {Node} */ -Range.prototype.startContainer; + // Inspector Backend var InspectorBackend = {} @@ -125,7 +124,7 @@ InspectorFrontendHostAPI.prototype.bringToFront = function() {} InspectorFrontendHostAPI.prototype.closeWindow = function() {} InspectorFrontendHostAPI.prototype.requestAttachWindow = function() {} InspectorFrontendHostAPI.prototype.requestDetachWindow = function() {} -InspectorFrontendHostAPI.prototype.requestSetDockSide = function(dockSide) {} +InspectorFrontendHostAPI.prototype.requestSetDockSide = function() {} InspectorFrontendHostAPI.prototype.setAttachedWindowHeight = function(height) {} InspectorFrontendHostAPI.prototype.moveWindowBy = function(x, y) {} InspectorFrontendHostAPI.prototype.setInjectedScriptForOrigin = function(origin, script) {} @@ -177,8 +176,6 @@ SourceMapV3.Offset = function() // FIXME: remove everything below. var WebInspector = {} -WebInspector.queryParamsObject = {} -WebInspector.toggleSearchingForNode = function() {} WebInspector.panels = {}; /** @@ -265,6 +262,13 @@ WebInspector.showPanel = function(panel) */ WebInspector.inspectedPageDomain; +/** + * @type {WebInspector.UserAgentSupport} + */ +WebInspector.userAgentSupport; + +WebInspector.isCompactMode = function() { return false; } + WebInspector.SourceJavaScriptTokenizer = {} WebInspector.SourceJavaScriptTokenizer.Keywords = {} diff --git a/Source/WebCore/inspector/front-end/helpScreen.css b/Source/WebCore/inspector/front-end/helpScreen.css index dde8aa96d..512980ed8 100644 --- a/Source/WebCore/inspector/front-end/helpScreen.css +++ b/Source/WebCore/inspector/front-end/helpScreen.css @@ -85,7 +85,6 @@ body.compact .help-window-main { border-radius: 8px; height: 16px; width: 16px; - line-height: 12px; position: absolute; top: 6px; right: 6px; diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css index 3846fbee3..1c126ea8e 100644 --- a/Source/WebCore/inspector/front-end/inspector.css +++ b/Source/WebCore/inspector/front-end/inspector.css @@ -66,8 +66,8 @@ body.inactive #toolbar { border-bottom: 1px solid rgb(64%, 64%, 64%); } -body.undocked.platform-mac-leopard #toolbar, -body.undocked.platform-mac-snowleopard #toolbar { +body.detached.platform-mac-leopard #toolbar, +body.detached.platform-mac-snowleopard #toolbar { background: transparent; } @@ -194,8 +194,8 @@ body.compact #toolbar-dropdown-arrow { background-image: inherit; } -body.undocked.platform-mac-leopard #toolbar-dropdown, -body.undocked.platform-mac-snowleopard #toolbar-dropdown { +body.detached.platform-mac-leopard #toolbar-dropdown, +body.detached.platform-mac-snowleopard #toolbar-dropdown { background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151))); } @@ -1020,11 +1020,6 @@ body.platform-linux .monospace, body.platform-linux .source-code { color: rgb(15%, 15%, 15%); } -ol.watch-expressions > li.hovered, -.console-message:hover { - background-color: #F0F0F0; -} - .console-message-url { float: right; margin-left: 4px; @@ -1371,6 +1366,7 @@ iframe.panel.extension { float: right; font-size: 10px; margin-left: 5px; + max-width: 55%; color: rgba(0, 0, 0, 0.7); text-overflow: ellipsis; overflow: hidden; @@ -1578,17 +1574,10 @@ li.editing .swatch, li.editing .enabled-button, li.editing-sub-part .delete-but .properties-tree.watch-expressions { padding-bottom: 8px; - padding-left: 4px !important; } -.properties-tree.watch-expressions > li { +.properties-tree.watch-expressions li { padding-top: 2px; - padding-left: 4px; -} - -.properties-tree.watch-expressions > li:not(.parent) { - margin-left: 1px; - padding-left: 15px; } .watch-expressions > li.editing-sub-part .text-prompt { @@ -1619,7 +1608,8 @@ li.editing .swatch, li.editing .enabled-button, li.editing-sub-part .delete-but background-repeat: no-repeat; border: 0 none transparent; position: absolute; - right: 8px; + margin-left: -25px; + margin-top: 2px; display: none; } diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html index 184da560c..cb9b8e86b 100644 --- a/Source/WebCore/inspector/front-end/inspector.html +++ b/Source/WebCore/inspector/front-end/inspector.html @@ -159,17 +159,15 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="HandlerRegistry.js"></script> <script type="text/javascript" src="SnippetStorage.js"></script> <script type="text/javascript" src="ScriptSnippetModel.js"></script> - <script type="text/javascript" src="Progress.js"></script> - <script type="text/javascript" src="ProgressIndicator.js"></script> + <script type="text/javascript" src="ProgressBar.js"></script> <script type="text/javascript" src="StylesSourceMapping.js"></script> <script type="text/javascript" src="StyleSource.js"></script> <script type="text/javascript" src="NetworkUISourceCodeProvider.js"></script> <script type="text/javascript" src="ElementsPanelDescriptor.js"></script> <script type="text/javascript" src="NetworkPanelDescriptor.js"></script> <script type="text/javascript" src="ScriptsPanelDescriptor.js"></script> - <script type="text/javascript" src="DockController.js"></script> </head> -<body class="undocked" id="-webkit-web-inspector"> +<body class="detached" id="-webkit-web-inspector"> <div id="toolbar"> <div class="toolbar-item close-left"><button id="close-button-left"></button></div> <div id="toolbar-controls"> diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index 2ee60be18..e77a90bfa 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -72,10 +72,13 @@ var WebInspector = { _createGlobalStatusBarItems: function() { var bottomStatusBarContainer = document.getElementById("bottom-status-bar-container"); + this._dockToggleButton = new WebInspector.StatusBarButton("", "dock-status-bar-item", 3); + this._dockToggleButton.makeLongClickEnabled(this._createDockOptions.bind(this)); + this._dockToggleButton.addEventListener("click", this._toggleAttach.bind(this), false); + this._updateDockButtonState(); - // Create main dock button and options. var mainStatusBar = document.getElementById("main-status-bar"); - mainStatusBar.insertBefore(this.dockController.element, bottomStatusBarContainer); + mainStatusBar.insertBefore(this._dockToggleButton.element, bottomStatusBarContainer); this._toggleConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIString("Show console."), "console-status-bar-item"); this._toggleConsoleButton.addEventListener("click", this._toggleConsoleButtonClicked.bind(this), false); @@ -90,6 +93,68 @@ var WebInspector = { mainStatusBar.appendChild(this.settingsController.statusBarItem); }, + _createDockOptions: function() + { + var alternateDockToggleButton1 = new WebInspector.StatusBarButton("Dock to main window.", "dock-status-bar-item", 3); + var alternateDockToggleButton2 = new WebInspector.StatusBarButton("Undock into separate window.", "dock-status-bar-item", 3); + + if (this.attached) { + alternateDockToggleButton1.state = WebInspector.settings.dockToRight.get() ? "bottom" : "right"; + alternateDockToggleButton2.state = "undock"; + } else { + alternateDockToggleButton1.state = WebInspector.settings.dockToRight.get() ? "bottom" : "right"; + alternateDockToggleButton2.state = WebInspector.settings.dockToRight.get() ? "right" : "bottom"; + } + + alternateDockToggleButton1.addEventListener("click", onClick.bind(this), false); + alternateDockToggleButton2.addEventListener("click", onClick.bind(this), false); + + function onClick(e) + { + var state = e.target.state; + if (state === "undock") + this._toggleAttach(); + else if (state === "right") { + if (!this.attached) + this._toggleAttach(); + WebInspector.settings.dockToRight.set(true); + } else if (state === "bottom") { + if (!this.attached) + this._toggleAttach(); + WebInspector.settings.dockToRight.set(false); + } + } + + return [alternateDockToggleButton1, alternateDockToggleButton2]; + }, + + _updateDockButtonState: function() + { + if (!this._dockToggleButton) + return; + + if (this.attached) { + this._dockToggleButton.disabled = false; + this._dockToggleButton.state = "undock"; + this._dockToggleButton.title = WebInspector.UIString("Undock into separate window."); + } else { + this._dockToggleButton.disabled = this._isDockingUnavailable; + this._dockToggleButton.state = WebInspector.settings.dockToRight.get() ? "right" : "bottom"; + this._dockToggleButton.title = WebInspector.UIString("Dock to main window."); + } + }, + + _toggleAttach: function() + { + if (!this._attached) { + InspectorFrontendHost.requestAttachWindow(); + WebInspector.userMetrics.WindowDocked.record(); + } else { + InspectorFrontendHost.requestDetachWindow(); + WebInspector.userMetrics.WindowUndocked.record(); + } + }, + _toggleConsoleButtonClicked: function() { if (this._toggleConsoleButton.disabled) @@ -158,6 +223,42 @@ var WebInspector = { } }, + get attached() + { + return this._attached; + }, + + set attached(x) + { + if (this._attached === x) + return; + + this._attached = x; + + if (x) + document.body.removeStyleClass("detached"); + else + document.body.addStyleClass("detached"); + + this._setCompactMode(x && !WebInspector.settings.dockToRight.get()); + this._updateDockButtonState(); + }, + + isCompactMode: function() + { + return this.attached && !WebInspector.settings.dockToRight.get(); + }, + + _setCompactMode: function(x) + { + var body = document.body; + if (x) + body.addStyleClass("compact"); + else + body.removeStyleClass("compact"); + WebInspector.windowResize(); + }, + _updateErrorAndWarningCounts: function() { var errorWarningElement = document.getElementById("error-warning-count"); @@ -233,13 +334,13 @@ var WebInspector = { _zoomIn: function() { - this._zoomLevel = Math.min(this._zoomLevel + 1, WebInspector.Zoom.Table.length - WebInspector.Zoom.DefaultOffset - 1); + ++this._zoomLevel; this._requestZoom(); }, _zoomOut: function() { - this._zoomLevel = Math.max(this._zoomLevel - 1, -WebInspector.Zoom.DefaultOffset); + --this._zoomLevel; this._requestZoom(); }, @@ -252,11 +353,7 @@ var WebInspector = { _requestZoom: function() { WebInspector.settings.zoomLevel.set(this._zoomLevel); - // For backwards compatibility, zoomLevel takes integers (with 0 being default zoom). - var index = this._zoomLevel + WebInspector.Zoom.DefaultOffset; - index = Math.min(WebInspector.Zoom.Table.length - 1, index); - index = Math.max(0, index); - InspectorFrontendHost.setZoomFactor(WebInspector.Zoom.Table[index]); + InspectorFrontendHost.setZoomFactor(Math.pow(1.2, this._zoomLevel)); }, toggleSearchingForNode: function() @@ -310,7 +407,6 @@ WebInspector.Events = { WebInspector.loaded = function() { InspectorBackend.loadFromJSONIfNeeded("../Inspector.json"); - WebInspector.dockController = new WebInspector.DockController(); if (WebInspector.WorkerManager.isDedicatedWorkerFrontend()) { // Do not create socket for the worker front-end. @@ -427,7 +523,6 @@ WebInspector._doLoadedDoneWithCapabilities = function() this.scriptSnippetModel = new WebInspector.ScriptSnippetModel(this.workspace); new WebInspector.DebuggerScriptMapping(this.workspace); - this.styleContentBinding = new WebInspector.StyleContentBinding(this.cssModel); new WebInspector.NetworkUISourceCodeProvider(this.workspace); new WebInspector.StylesSourceMapping(this.workspace); if (WebInspector.experimentsSettings.sass.isEnabled()) @@ -437,6 +532,8 @@ WebInspector._doLoadedDoneWithCapabilities = function() this._createGlobalStatusBarItems(); + WebInspector._installDockToRight(); + this.toolbar = new WebInspector.Toolbar(); WebInspector.startBatchUpdate(); var panelDescriptors = this._panelDescriptors(); @@ -482,6 +579,36 @@ WebInspector._doLoadedDoneWithCapabilities = function() InspectorFrontendAPI.loadCompleted(); } +WebInspector._installDockToRight = function() +{ + // Re-use Settings infrastructure for the dock-to-right settings UI + WebInspector.settings.dockToRight.set(WebInspector.queryParamsObject.dockSide === "right"); + + if (WebInspector.settings.dockToRight.get()) + document.body.addStyleClass("dock-to-right"); + + if (WebInspector.attached) + WebInspector._setCompactMode(!WebInspector.settings.dockToRight.get()); + + WebInspector.settings.dockToRight.addChangeListener(listener.bind(this)); + + function listener(event) + { + var value = WebInspector.settings.dockToRight.get(); + if (value) { + InspectorFrontendHost.requestSetDockSide("right"); + document.body.addStyleClass("dock-to-right"); + } else { + InspectorFrontendHost.requestSetDockSide("bottom"); + document.body.removeStyleClass("dock-to-right"); + } + if (WebInspector.attached) + WebInspector._setCompactMode(!value); + else + WebInspector._updateDockButtonState(); + } +} + var windowLoaded = function() { var localizedStringsURL = InspectorFrontendHost.localizedStringsURL(); @@ -494,6 +621,8 @@ var windowLoaded = function() } else WebInspector.loaded(); + WebInspector.attached = WebInspector.queryParamsObject.docked === "true"; + window.removeEventListener("DOMContentLoaded", windowLoaded, false); delete windowLoaded; }; @@ -538,8 +667,8 @@ WebInspector.windowResize = function(event) WebInspector.setDockingUnavailable = function(unavailable) { - if (this.dockController) - this.dockController.setDockingUnavailable(unavailable); + this._isDockingUnavailable = unavailable; + this._updateDockButtonState(); } WebInspector.close = function(event) @@ -966,8 +1095,3 @@ WebInspector.addMainEventListeners = function(doc) } WebInspector.ProfileURLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/; - -WebInspector.Zoom = { - Table: [0.25, 0.33, 0.5, 0.66, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5], - DefaultOffset: 6 -} diff --git a/Source/WebCore/inspector/front-end/inspectorCommon.css b/Source/WebCore/inspector/front-end/inspectorCommon.css index 41b44faaf..89c84ba07 100644 --- a/Source/WebCore/inspector/front-end/inspectorCommon.css +++ b/Source/WebCore/inspector/front-end/inspectorCommon.css @@ -17,11 +17,11 @@ body { -webkit-user-select: none; } -body.dock-to-right:not(.undocked) { +body.dock-to-right:not(.detached) { border-left: 1px solid rgb(80, 80, 80); } -body.dock-to-right.inactive:not(.undocked) { +body.dock-to-right.inactive:not(.detached) { border-left: 1px solid rgb(64%, 64%, 64%); } diff --git a/Source/WebCore/inspector/front-end/networkPanel.css b/Source/WebCore/inspector/front-end/networkPanel.css index cda6d10b1..a80c61d1e 100644 --- a/Source/WebCore/inspector/front-end/networkPanel.css +++ b/Source/WebCore/inspector/front-end/networkPanel.css @@ -191,6 +191,10 @@ margin-top: 1px; } +.resource-headers-view .outline-disclosure .raw-form-data { + white-space: pre-wrap; +} + .resource-cookies-view { display: none; position: absolute; diff --git a/Source/WebCore/inspector/front-end/treeoutline.js b/Source/WebCore/inspector/front-end/treeoutline.js index affc9ac3e..814d33160 100644 --- a/Source/WebCore/inspector/front-end/treeoutline.js +++ b/Source/WebCore/inspector/front-end/treeoutline.js @@ -885,7 +885,7 @@ TreeElement.prototype.expandRecursively = function(maxDepth) // The Inspector uses TreeOutlines to represents object properties, so recursive expansion // in some case can be infinite, since JavaScript objects can hold circular references. // So default to a recursion cap of 3 levels, since that gives fairly good results. - if (isNaN(maxDepth)) + if (typeof maxDepth === "undefined" || typeof maxDepth === "null") maxDepth = 3; while (item) { @@ -1002,7 +1002,7 @@ TreeElement.prototype.onexpand = function() { } TreeElement.prototype.oncollapse = function() { } TreeElement.prototype.ondblclick = function() { } TreeElement.prototype.onreveal = function() { } -/** @param {boolean=} selectedByUser */ +/** @param {boolean} selectedByUser */ TreeElement.prototype.onselect = function(selectedByUser) { } /** |