[Webkit-unassigned] [Bug 167549] New: Invoking callback should allow setting the `this` object
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Jan 28 02:28:42 PST 2017
https://bugs.webkit.org/show_bug.cgi?id=167549
Bug ID: 167549
Summary: Invoking callback should allow setting the `this`
object
Classification: Unclassified
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebCore Misc.
Assignee: webkit-unassigned at lists.webkit.org
Reporter: joepeck at webkit.org
CC: cdumez at apple.com, sam at webkit.org
Summary:
Invoking callback should allow setting the `this` object.
Cases like IntersectionObserver, PerformanceObserver and MutationObserver.
For example PerformanceObserver:
<script>
let observer = new PerformanceObserver(function f(list, obs) {
console.log("this", this); // Expected `observer`, was `arguments.callee`
})
observer.observe({entryTypes: ["mark"]});
performance.mark("mark1");
</script>
The callbacks and their interface are autogenerated from WebIDL and have a handleEvent method. Seems we need a way to the `this` object in some cases. (Probably not all, requestAnimationFrame for example prolly doesn't have the same constraints).
Currently this works with MutationObserver, which has a custom implementation of the callback (not generated). See JSMutationCallback.
<body>
<div id="my-div"></div>
<script>
var target = document.getElementById("my-div");
var observer = new MutationObserver(function(mutations) {
console.log("this", this); // Expected `observer` but is `arguments.callee`
});
observer.observe(target, {childList: true});
target.appendChild( document.createElement("span") );
</script>
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170128/61698028/attachment.html>
More information about the webkit-unassigned
mailing list