Index: third_party/WebKit/LayoutTests/bindings/location-lifetime.html |
diff --git a/third_party/WebKit/LayoutTests/bindings/location-lifetime.html b/third_party/WebKit/LayoutTests/bindings/location-lifetime.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2fa7c79b8e0c4a24129ff55c91dcb87748406e30 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/bindings/location-lifetime.html |
@@ -0,0 +1,28 @@ |
+<!doctype html> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<iframe id="iframe-for-document.location"></iframe> |
+<iframe id="iframe-for-window.location"></iframe> |
+<script> |
+test(() => { |
+ let observation; |
+ (function() { |
+ let iframe = document.getElementById("iframe-for-document.location"); |
+ let location = iframe.contentDocument.location; |
+ observation = internals.observeGC(location); |
+ })(); |
+ gc(); |
+ assert_false(observation.wasCollected, "Location wrapper object was collected."); |
+}, "document.location shouldn't be collected by GC."); |
+ |
+test(() => { |
+ let observation; |
+ (function() { |
+ let iframe = document.getElementById("iframe-for-window.location"); |
+ let location = iframe.contentWindow.location; |
+ observation = internals.observeGC(location); |
+ })(); |
+ gc(); |
+ assert_false(observation.wasCollected, "Location wrapper object was collected."); |
+}, "window.location shouldn't be collected by GC."); |
+</script> |