Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: third_party/WebKit/LayoutTests/resize-observer/observe.html

Issue 2303893003: Pass ResizeObserver as 'this' to callback (Closed)
Patch Set: CR fixes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8ResizeObserverCallbackCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/resize-observer/observe.html
diff --git a/third_party/WebKit/LayoutTests/resize-observer/observe.html b/third_party/WebKit/LayoutTests/resize-observer/observe.html
index 3a47d30bc7ca2b4e2cc114e4141f7fddd02fb384..ea3bc6f7448c1bfa5b3429fb828dd344ac31f0cc 100644
--- a/third_party/WebKit/LayoutTests/resize-observer/observe.html
+++ b/third_party/WebKit/LayoutTests/resize-observer/observe.html
@@ -164,6 +164,29 @@ function test6() {
return promise;
}
+function test7() {
+ let harnessTest = async_test("test7: callback.this");
+ let resolvePromise;
+ let ro = new ResizeObserver( function(entries, obs) {
+ let callbackThis = this;
+ resolvePromise();
+ harnessTest.step(() => {
+ assert_equals(callbackThis, ro, "callback.this is ResizeObserver");
+ assert_equals(obs, ro, "2nd argument is ResizeObserver");
+ ro.disconnect();
+ ro = null; // must null every reference to RO to prevent leaks
eae 2016/09/05 20:52:48 Is this documented anywhere?
esprehn 2016/09/06 01:35:30 Yeah that doesn't seem right, you shouldn't need t
esprehn 2016/09/06 01:35:31 Yeah that doesn't seem right, you shouldn't need t
atotic1 2016/09/06 17:22:37 This is only required to pass run-webkit-tests --e
haraken 2016/09/07 01:59:45 Ah, this makes sense. It's totally valid a thing t
+ callbackThis = null;
+ obs = null;
+ harnessTest.done();
+ });
+ }
+ );
+ ro.observe(t1);
+
+ return new Promise( (resolve, reject) => {
+ resolvePromise = resolve;
+ });
+}
let guard = async_test('guard');
test0()
.then(() => { return test1(); })
@@ -172,6 +195,7 @@ test0()
.then(() => { return test4(); })
.then(() => { return test5(); })
.then(() => { return test6(); })
+ .then(() => { return test7(); })
.then(() => { guard.done(); });
</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8ResizeObserverCallbackCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698