Changeset 129105 in webkit
- Timestamp:
- Sep 20, 2012 1:33:46 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r129097 r129105 1 2012-09-18 Alexander Pavlov <apavlov@chromium.org> 2 3 Web Inspector: Use and process the actual ScriptId in the protocol EventListener object 4 https://bugs.webkit.org/show_bug.cgi?id=93271 5 6 Reviewed by Yury Semikhatsky. 7 8 - Use the actual script identifier in the "location" object's "scriptId" field 9 for the DOM.EventListener protocol type, but send the script URL in the new "sourceName" field. 10 - Use 0-based lines in the "location" object's "lineNumber" field for linkifyRawLocation() to work correctly. 11 - Fixed formatting of links to listener locations to contain "(program)" rather than empty string. 12 13 * bindings/js/ScriptEventListener.cpp: 14 (WebCore::eventListenerHandlerLocation): 15 * bindings/js/ScriptEventListener.h: 16 (WebCore): 17 * bindings/v8/ScriptEventListener.cpp: 18 (WebCore::eventListenerHandlerLocation): 19 * bindings/v8/ScriptEventListener.h: 20 (WebCore): 21 * inspector/Inspector.json: 22 * inspector/InspectorDOMAgent.cpp: 23 (WebCore::InspectorDOMAgent::buildObjectForEventListener): 24 * inspector/front-end/BreakpointsSidebarPane.js: 25 * inspector/front-end/EventListenersSidebarPane.js: 26 * inspector/front-end/Linkifier.js: 27 (WebInspector.Linkifier.DefaultFormatter.prototype.formatLiveAnchor): 28 * inspector/front-end/ResourceUtils.js: 29 (WebInspector.formatLinkText): Use "(program)" if URL is empty. 30 1 31 2012-09-19 Dan Bernstein <mitz@apple.com> 2 32 -
trunk/Source/WebCore/bindings/js/ScriptEventListener.cpp
r127191 r129105 107 107 } 108 108 109 bool eventListenerHandlerLocation(Document* document, EventListener* eventListener, String& sourceName, int& lineNumber)109 bool eventListenerHandlerLocation(Document* document, EventListener* eventListener, String& sourceName, String& scriptId, int& lineNumber) 110 110 { 111 111 const JSEventListener* jsListener = JSEventListener::cast(eventListener); … … 123 123 if (!funcExecutable) 124 124 return false; 125 lineNumber = funcExecutable->lineNo(); 125 lineNumber = funcExecutable->lineNo() - 1; 126 intptr_t funcSourceId = funcExecutable->sourceID(); 127 scriptId = funcSourceId == SourceProvider::nullID ? "" : String::number(funcSourceId); 126 128 sourceName = funcExecutable->sourceURL(); 127 129 return true; -
trunk/Source/WebCore/bindings/js/ScriptEventListener.h
r117195 r129105 47 47 PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, const Attribute&); 48 48 String eventListenerHandlerBody(Document*, EventListener*); 49 bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, int& lineNumber);49 bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, String& scriptId, int& lineNumber); 50 50 } // namespace WebCore 51 51 -
trunk/Source/WebCore/bindings/v8/ScriptEventListener.cpp
r127062 r129105 105 105 } 106 106 107 bool eventListenerHandlerLocation(Document* document, EventListener* listener, String& sourceName, int& lineNumber)107 bool eventListenerHandlerLocation(Document* document, EventListener* listener, String& sourceName, String& scriptId, int& lineNumber) 108 108 { 109 109 if (listener->type() != EventListener::JSEventListenerType) … … 119 119 120 120 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(object); 121 v8::Handle<v8::Value> scriptIdValue = function->GetScriptId(); 122 scriptId = toWebCoreStringWithNullOrUndefinedCheck(scriptIdValue); 121 123 v8::ScriptOrigin origin = function->GetScriptOrigin(); 122 if ( !origin.ResourceName().IsEmpty()) {124 if (origin.ResourceName()->IsString() && !origin.ResourceName().IsEmpty()) 123 125 sourceName = toWebCoreString(origin.ResourceName()); 124 lineNumber = function->GetScriptLineNumber() + 1;125 return true;126 }127 return false;126 else 127 sourceName = ""; 128 lineNumber = function->GetScriptLineNumber(); 129 return true; 128 130 } 129 131 -
trunk/Source/WebCore/bindings/v8/ScriptEventListener.h
r117195 r129105 47 47 PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, const Attribute&); 48 48 String eventListenerHandlerBody(Document*, EventListener*); 49 bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, int& lineNumber);49 bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, String& scriptId, int& lineNumber); 50 50 51 51 } // namespace WebCore -
trunk/Source/WebCore/inspector/Inspector.json
r128992 r129105 1589 1589 { "name": "nodeId", "$ref": "NodeId", "description": "Target <code>DOMNode</code> id." }, 1590 1590 { "name": "handlerBody", "type": "string", "description": "Event handler function body." }, 1591 { "name": "location", "$ref": "Debugger.Location", "optional": true, "description": "Handler code location." } 1591 { "name": "location", "$ref": "Debugger.Location", "optional": true, "description": "Handler code location." }, 1592 { "name": "sourceName", "type": "string", "optional": true, "description": "Source script URL." } 1592 1593 ], 1593 1594 "description": "DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type." -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r128572 r129105 1305 1305 .setHandlerBody(eventListenerHandlerBody(node->document(), eventListener.get())); 1306 1306 String sourceName; 1307 String scriptId; 1307 1308 int lineNumber; 1308 if (eventListenerHandlerLocation(node->document(), eventListener.get(), sourceName, lineNumber)) {1309 if (eventListenerHandlerLocation(node->document(), eventListener.get(), sourceName, scriptId, lineNumber)) { 1309 1310 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Location::create() 1310 .setScriptId(s ourceName)1311 .setScriptId(scriptId) 1311 1312 .setLineNumber(lineNumber); 1312 1313 value->setLocation(location); 1314 if (!sourceName.isEmpty()) 1315 value->setSourceName(sourceName); 1313 1316 } 1314 1317 return value.release(); -
trunk/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js
r126012 r129105 73 73 element.appendChild(checkbox); 74 74 75 var url = uiLocation.uiSourceCode.url; 76 var displayName = url ? WebInspector.displayNameForURL(url) : WebInspector.UIString("(program)"); 77 var labelElement = document.createTextNode(displayName + ":" + (uiLocation.lineNumber + 1)); 75 var labelElement = document.createTextNode(WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber)); 78 76 element.appendChild(labelElement); 79 77 -
trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js
r121021 r129105 179 179 _update: function(uiLocation) 180 180 { 181 this.subtitle = WebInspector. displayNameForURL(uiLocation.uiSourceCode.url) + ":" + (uiLocation.lineNumber + 1);181 this.subtitle = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber); 182 182 }, 183 183 -
trunk/Source/WebCore/inspector/front-end/EventListenersSidebarPane.js
r126430 r129105 205 205 if (typeof this.eventListener.handlerBody !== "undefined") 206 206 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("listenerBody", this.eventListener.handlerBody)); 207 if (this.eventListener. location) {208 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("sourceName", this.eventListener. location.scriptId));209 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("lineNumber", this.eventListener.location.lineNumber));210 }207 if (this.eventListener.sourceName) 208 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("sourceName", this.eventListener.sourceName)); 209 if (this.eventListener.location) 210 properties.push(WebInspector.RemoteObjectProperty.fromPrimitiveValue("lineNumber", this.eventListener.location.lineNumber + 1)); 211 211 212 212 this.updateProperties(properties); … … 240 240 if (this.eventListener.location) { 241 241 this.subtitleElement.removeChildren(); 242 // FIXME(62725): eventListener.location should be a debugger Location. 243 var url = this.eventListener.location.scriptId; 244 var lineNumber = this.eventListener.location.lineNumber - 1; 245 var columnNumber = 0; 246 var urlElement = linkifier.linkifyLocation(url, lineNumber, columnNumber); 242 var urlElement; 243 if (this.eventListener.location.scriptId) 244 urlElement = linkifier.linkifyRawLocation(this.eventListener.location); 245 if (!urlElement) { 246 var url = this.eventListener.sourceName; 247 var lineNumber = this.eventListener.location.lineNumber; 248 var columnNumber = 0; 249 urlElement = linkifier.linkifyLocation(url, lineNumber, columnNumber); 250 } 247 251 this.subtitleElement.appendChild(urlElement); 248 252 } else { -
trunk/Source/WebCore/inspector/front-end/Linkifier.js
r126572 r129105 122 122 formatLiveAnchor: function(anchor, uiLocation) 123 123 { 124 anchor.textContent = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber);125 126 124 var text = WebInspector.formatLinkText(uiLocation.uiSourceCode.url, uiLocation.lineNumber); 127 125 if (this._maxLength) -
trunk/Source/WebCore/inspector/front-end/ResourceUtils.js
r126579 r129105 193 193 WebInspector.formatLinkText = function(url, lineNumber) 194 194 { 195 var text = WebInspector.displayNameForURL(url);195 var text = url ? WebInspector.displayNameForURL(url) : WebInspector.UIString("(program)"); 196 196 if (typeof lineNumber === "number") 197 197 text += ":" + (lineNumber + 1);
Note: See TracChangeset
for help on using the changeset viewer.