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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/dangling-markup/resources/helper.js

Issue 2634893003: Experiment with blocking resolution of HTTP URLs containing '\n' and '<'. (Closed)
Patch Set: Culling. Created 3 years, 11 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/LayoutTests/http/tests/security/dangling-markup/src-attribute.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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`;
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/dangling-markup/src-attribute.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698