RESOLVED FIXED 57466
Web Inspector: provide front-end wrappers for DOMAgent.querySelector[All]() that take care of fetching the document
https://bugs.webkit.org/show_bug.cgi?id=57466
Summary Web Inspector: provide front-end wrappers for DOMAgent.querySelector[All]() t...
Andrey Kosyakov
Reported 2011-03-30 09:26:21 PDT
Requiring document to be set on front-end before calls to querySelector[All]() is counter-intuitive. This is a better fix for bug 57349 (with some cosmetic drive-by fixes)
Attachments
patch (11.67 KB, patch)
2011-03-30 09:31 PDT, Andrey Kosyakov
pfeldman: review+
patch (17.22 KB, patch)
2011-03-31 06:42 PDT, Andrey Kosyakov
pfeldman: review+
Andrey Kosyakov
Comment 1 2011-03-30 09:31:12 PDT
Pavel Feldman
Comment 2 2011-03-30 22:25:13 PDT
Comment on attachment 87549 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=87549&action=review > Source/WebCore/inspector/front-end/AuditRules.js:675 > + console.error("Failed to get image style"); When does this happen? > Source/WebCore/inspector/front-end/AuditRules.js:731 > + console.error("Failed to get styles"); ditto > Source/WebCore/inspector/front-end/DOMAgent.js:363 > + requestArguments.push(callbackWrapper); do you want to do this only in the success branch of onDocumentAvailable? > Source/WebCore/inspector/front-end/DOMAgent.js:495 > + DOMAgent.querySelector(nodeId || this._document.id, selectors, documentWide, wrappedCallback); So 0 is still valid? I thought we agreed on not allowing it here.
Andrey Kosyakov
Comment 3 2011-03-31 06:40:29 PDT
Comment on attachment 87549 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=87549&action=review >> Source/WebCore/inspector/front-end/AuditRules.js:675 >> + console.error("Failed to get image style"); > > When does this happen? This used to happen because we were getting 0 ids from querySelectorAll(), because document wasn't pushed to front-end. I actually removed it now, this is only supposed to happen in case something seriously went wrong in other places, so let's crash instead. >> Source/WebCore/inspector/front-end/AuditRules.js:731 >> + console.error("Failed to get styles"); > > ditto Now this is a bit different, this happens only in case we receive error from getStylesAsync() (from what I can see, this is only in case we supplied invalid node id -- yet, if there's a possibility of a function to return error, we shouldn't be swallowing it or crashing on it, hence I just added logging). >> Source/WebCore/inspector/front-end/DOMAgent.js:363 >> + requestArguments.push(callbackWrapper); > > do you want to do this only in the success branch of onDocumentAvailable? I tried it, but didn't quite like it -- we need to extract callback from the argument list anyway, and I think that having this push together with callback extraction logic makes things a bit more readable. >> Source/WebCore/inspector/front-end/DOMAgent.js:495 >> + DOMAgent.querySelector(nodeId || this._document.id, selectors, documentWide, wrappedCallback); > > So 0 is still valid? I thought we agreed on not allowing it here. Yup, now the document request logic moves to client (and I'm also dropping documentWide parameter altogether, as discussed).
Andrey Kosyakov
Comment 4 2011-03-31 06:42:50 PDT
Created attachment 87716 [details] patch - removed documentWide parameter to querySelector[All]() - moved document request logic from DOMAgent.js to the client side
Andrey Kosyakov
Comment 5 2011-04-05 07:27:40 PDT
Note You need to log in before you can comment on or make changes to this bug.