WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
156696
Web Inspector: Fix the debounce function
https://bugs.webkit.org/show_bug.cgi?id=156696
Summary
Web Inspector: Fix the debounce function
Timothy Hatcher
Reported
2016-04-18 07:52:04 PDT
It puts the symbol on the bound function, not the original.
Attachments
Patch
(2.05 KB, patch)
2016-04-18 08:15 PDT
,
Timothy Hatcher
bburg
: review+
timothy
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-04-18 07:52:19 PDT
<
rdar://problem/25778133
>
Timothy Hatcher
Comment 2
2016-04-18 08:15:43 PDT
Created
attachment 276638
[details]
Patch
Blaze Burg
Comment 3
2016-04-18 08:53:44 PDT
Comment on
attachment 276638
[details]
Patch r=me Could you include a short description of how to use this function? I had to go over to underscore.js to confirm what I thought was going on.
Timothy Hatcher
Comment 4
2016-04-18 10:29:07 PDT
https://trac.webkit.org/changeset/199676
Joseph Pecoraro
Comment 5
2016-04-18 13:43:38 PDT
Comment on
attachment 276638
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=276638&action=review
> Source/WebInspectorUI/UserInterface/Base/Utilities.js:1210 > - let callback = this.bind(thisObject); > - return function() { > - clearTimeout(callback[debounceSymbol]); > + return () => { > + clearTimeout(this[debounceSymbol]); > + > let args = arguments; > - callback[debounceSymbol] = setTimeout(() => { > - callback.apply(null, args); > + this[debounceSymbol] = setTimeout(() => { > + this.apply(thisObject, args); > }, delay); > };
I don't think this works. Because the "arguments" here are not the correct arguments. Looking back at the original bug:
https://bugs.webkit.org/show_bug.cgi?id=152655
Maybe this can be reduced to: value: function(delay, thisObject) { return (...args) => { clearTimeout(this[debounceSymbol]); this[debounceSymbol] = setTimeout(this.bind(thisObject), delay, ...args); } } We could add a unit-test for this.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug