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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="./resources/resizeTestHelper.js"></script> 4 <script src="./resources/resizeTestHelper.js"></script>
5 <p>ResizeObserver tests</p> 5 <p>ResizeObserver tests</p>
6 <div id="target1" style="width:100px;height:100px;">t1</div> 6 <div id="target1" style="width:100px;height:100px;">t1</div>
7 <div id="target2" style="width:100px;height:100px;">t2</div> 7 <div id="target2" style="width:100px;height:100px;">t2</div>
8 <img id="target3" style="width:100px;height:100px;"> 8 <img id="target3" style="width:100px;height:100px;">
9 <iframe src="./resources/iframe.html" width="300px" height="100px" style="displa y:block"></iframe> 9 <iframe src="./resources/iframe.html" width="300px" height="100px" style="displa y:block"></iframe>
10 <script> 10 <script>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 test.done(); 157 test.done();
158 resolvePromise(); 158 resolvePromise();
159 }); 159 });
160 }); 160 });
161 break; 161 break;
162 } 162 }
163 }, false); 163 }, false);
164 return promise; 164 return promise;
165 } 165 }
166 166
167 function test7() {
168 let harnessTest = async_test("test7: callback.this");
169 let resolvePromise;
170 let ro = new ResizeObserver( function(entries, obs) {
171 let callbackThis = this;
172 resolvePromise();
173 harnessTest.step(() => {
174 assert_equals(callbackThis, ro, "callback.this is ResizeObserver");
175 assert_equals(obs, ro, "2nd argument is ResizeObserver");
176 ro.disconnect();
177 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
178 callbackThis = null;
179 obs = null;
180 harnessTest.done();
181 });
182 }
183 );
184 ro.observe(t1);
185
186 return new Promise( (resolve, reject) => {
187 resolvePromise = resolve;
188 });
189 }
167 let guard = async_test('guard'); 190 let guard = async_test('guard');
168 test0() 191 test0()
169 .then(() => { return test1(); }) 192 .then(() => { return test1(); })
170 .then(() => { return test2(); }) 193 .then(() => { return test2(); })
171 .then(() => { return test3(); }) 194 .then(() => { return test3(); })
172 .then(() => { return test4(); }) 195 .then(() => { return test4(); })
173 .then(() => { return test5(); }) 196 .then(() => { return test5(); })
174 .then(() => { return test6(); }) 197 .then(() => { return test6(); })
198 .then(() => { return test7(); })
175 .then(() => { guard.done(); }); 199 .then(() => { guard.done(); });
176 200
177 </script> 201 </script>
OLDNEW
« 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