| Index: third_party/WebKit/LayoutTests/http/tests/security/dangling-markup/resources/helper.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/dangling-markup/resources/helper.js b/third_party/WebKit/LayoutTests/http/tests/security/dangling-markup/resources/helper.js
|
| index 7d5ad6d10d025e836701eeb96754bad2e17076ed..100bcba7b5184a12955c6c99ce21c483301ef446 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/security/dangling-markup/resources/helper.js
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/dangling-markup/resources/helper.js
|
| @@ -4,6 +4,16 @@ function assert_no_message_from_frame(test, frame) {
|
| }));
|
| }
|
|
|
| +function appendFrameAndGetElement(test, frame) {
|
| + return new Promise((resolve, reject) => {
|
| + frame.onload = test.step_func(_ => {
|
| + frame.onload = null;
|
| + resolve(frame.contentDocument.querySelector('#dangling'));
|
| + });
|
| + document.body.appendChild(frame);
|
| + });
|
| +}
|
| +
|
| function appendAndSubmit(test, frame) {
|
| return new Promise((resolve, reject) => {
|
| frame.onload = test.step_func(_ => {
|
| @@ -30,6 +40,22 @@ function assert_no_submission(test, frame) {
|
| }));
|
| }
|
|
|
| +function assert_img_loaded(test, frame) {
|
| + appendFrameAndGetElement(test, frame)
|
| + .then(test.step_func_done(img => {
|
| + assert_equals(img.naturalHeight, 103, "Height");
|
| + assert_equals(img.naturalWidth, 76, "Width");
|
| + }));
|
| +}
|
| +
|
| +function assert_img_not_loaded(test, frame) {
|
| + appendFrameAndGetElement(test, frame)
|
| + .then(test.step_func_done(img => {
|
| + assert_equals(img.naturalHeight, 0, "Height");
|
| + assert_equals(img.naturalWidth, 0, "Width");
|
| + }));
|
| +}
|
| +
|
| function createFrame(markup) {
|
| var i = document.createElement('iframe');
|
| i.srcdoc = `${markup}sekrit`;
|
|
|