Incorrect value of "this" binding in ResizeObservers' callback
Reported by
que....@gmail.com,
Aug 26 2016
|
|||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.0 Safari/537.36
Steps to reproduce the problem:
1. Execute following code:
(function () {
'use strict';
let observer = new ResizeObserver(function (entries, instance) {
console.log(this, this === observer);
});
observer.observe(document.body);
})();
What is the expected behavior?
According to the spec (https://wicg.github.io/ResizeObserver/#api) ResizeObserver is modeled after MutationObserver and IntersectionObserver API's in which
"this" binding of a callback function references the observer instance that it was invoked by.
What went wrong?
Value of "this" binding is undefined.
Did this work before? No
Chrome version: 54.0.2840.0 Channel: canary
OS Version: 10.0
Flash Version: Shockwave Flash 22.0 r0
,
Aug 29 2016
,
Aug 30 2016
Considering this as a Feature request and marking it as untriaged.
,
Aug 31 2016
,
Sep 9 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e4ae0871bcb1c269d81b006eb9522c306a2bdf37 commit e4ae0871bcb1c269d81b006eb9522c306a2bdf37 Author: atotic <atotic@google.com> Date: Fri Sep 09 00:52:18 2016 Pass ResizeObserver as 'this' to callback I had to implement a custom callback dispatch handler. Used MutationObserver code as a template. Added a test case. BUG= 641353 Review-Url: https://codereview.chromium.org/2303893003 Cr-Commit-Position: refs/heads/master@{#417464} [modify] https://crrev.com/e4ae0871bcb1c269d81b006eb9522c306a2bdf37/third_party/WebKit/LayoutTests/resize-observer/observe.html [modify] https://crrev.com/e4ae0871bcb1c269d81b006eb9522c306a2bdf37/third_party/WebKit/Source/bindings/bindings.gni [add] https://crrev.com/e4ae0871bcb1c269d81b006eb9522c306a2bdf37/third_party/WebKit/Source/bindings/core/v8/V8ResizeObserverCallbackCustom.cpp [modify] https://crrev.com/e4ae0871bcb1c269d81b006eb9522c306a2bdf37/third_party/WebKit/Source/core/observer/ResizeObserverCallback.idl
,
Sep 9 2016
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by kapishnikov@chromium.org
, Aug 26 2016