[webkit-reviews] review granted: [Bug 130702] Web Inspector: protocol command invocations should return a promise if no callback is supplied : [Attachment 235433] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 5 15:23:18 PDT 2014


Timothy Hatcher <timothy at apple.com> has granted Brian Burg
<burg at cs.washington.edu>'s request for review:
Bug 130702: Web Inspector: protocol command invocations should return a promise
if no callback is supplied
https://bugs.webkit.org/show_bug.cgi?id=130702

Attachment 235433: Patch
https://bugs.webkit.org/attachment.cgi?id=235433&action=review

------- Additional Comments from Timothy Hatcher <timothy at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=235433&action=review


>>> Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js:329
>>> +	     var commandArguments = Array.prototype.slice.call(arguments);
>> 
>> This seems like it could be a lot of work to just get our Array.lastValue
implementation on an Arguments object. This (potentially) creates and throws
away an Array each call. I would suggest just a quick check ourselves.
>> 
>>     // If the last argument to the command is not a function, return a
result promise.
>>     if (arguments.length === 0 || typeof arguments[arguments.length - 1] !==
"function")
>>	   return instance.promise.apply(instance, arguments);
>> 
>> Maybe even just "typeof arguments[arguments.length - 1]".
> 
> oh, duh :)

Yeah this would be good to fix.


More information about the webkit-reviews mailing list