Index: LayoutTests/fast/domurl/url-searchparams.html |
diff --git a/LayoutTests/fast/domurl/url-searchparams.html b/LayoutTests/fast/domurl/url-searchparams.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3733600df4def358620aa28d5c84d612e2829f8a |
--- /dev/null |
+++ b/LayoutTests/fast/domurl/url-searchparams.html |
@@ -0,0 +1,56 @@ |
+<!DOCTYPE html> |
+<link rel="help" href="http://url.spec.whatwg.org/#interface-urlsearchparams"> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+if (!window.gc) |
+{ |
+ window.gc = function() { |
+ if (window.GCController) |
+ return GCController.collect(); |
+ for (var i = 0; i < 10000; i++) |
+ var s = new String("abc"); |
+ } |
+} |
+ |
+test(function() { |
+ assert_true("URLSearchParams" in window); |
+ assert_true("toString" in URLSearchParams.prototype); |
+ assert_true("append" in URLSearchParams.prototype); |
+ assert_true("delete" in URLSearchParams.prototype); |
+ assert_true("get" in URLSearchParams.prototype); |
+ assert_true("getAll" in URLSearchParams.prototype); |
+ assert_true("has" in URLSearchParams.prototype); |
+ assert_true("set" in URLSearchParams.prototype); |
+}, "URLSearchParams interface"); |
+ |
+test(function() { |
+ // Exercise handling of reference counting. Pass if no crash. |
+ var u1 = new URLSearchParams("a=b&c=d"); |
+ u1 = null; |
+ gc(); |
+ // Expect 'u' gone. |
+ |
+ var u2 = new URLSearchParams("a=b&c=d"); |
+ var url2 = new URL("http://example.org/file?a=b&c=d"); |
+ // Creates and returns an URLSearchParams. |
+ url2.searchParams; |
+ url2.searchParams = u2; |
+ u2 = null; |
+ gc(); |
+ // Expect url2's original searchParams + u2 gone. |
+ |
+ url2.searchParams = new URLSearchParams(); |
+ gc(); |
+ // Expect u2's original searchParams gone. |
+ url2 = null; |
+ |
+ var url3 = new URL("http://example.org/file?a=b&c=d"); |
+ var u3 = new URLSearchParams(); |
+ url3.searchParams = u3; |
+ url3.searchParams = u3; |
+ gc(); |
+ url3 = u3 = null; |
+ gc(); |
+}, "URLSearchParams GC handling"); |
arv (Not doing code reviews)
2014/01/22 16:12:05
Is there a test for object identity?
var url = ne
sof
2014/01/22 17:15:47
Gnarly stuff. The setter has a copying semantics i
sof
2014/01/22 17:24:55
Oh, and if you set 'us' yet again, it will start h
sof
2014/01/24 07:11:37
Added a test for assumed behavior of the setter +
|
+</script> |