Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/test-helpers.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
index 65215669d63e267a851f047b4f28bd4b1e3cc650..a45f85a25b3365f084fec177aea8a3b7dbc00110 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/test-helpers.js |
@@ -44,14 +44,16 @@ function unreached_rejection(test, prefix) { |
} |
// Adds an iframe to the document and returns a promise that resolves to the |
-// iframe when it finishes loading. The caller is responsible for removing the |
-// iframe later if needed. |
-function with_iframe(url) { |
+// iframe when it finishes loading. By default, the caller is responsible for |
nhiroki
2016/04/06 07:46:35
"By default" sounds a bit unclear. Can you elabora
falken
2016/04/06 07:49:05
Drive-by comment: How about making reclaim_after_c
shimazu (google)
2016/04/07 04:17:59
Done.
|
+// removing the iframe later if needed. |
+function with_iframe(url, reclaim_after_completion) { |
return new Promise(function(resolve) { |
var frame = document.createElement('iframe'); |
frame.src = url; |
frame.onload = function() { resolve(frame); }; |
document.body.appendChild(frame); |
+ if (reclaim_after_completion) |
nhiroki
2016/04/06 07:46:35
if (reclaim_after_compleation === true)
... could
shimazu (google)
2016/04/07 04:17:59
Done.
|
+ add_completion_callback(function() { frame.remove(); }); |
}); |
} |