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

Side by Side Diff: LayoutTests/fast/domurl/url-searchparams.html

Issue 143313002: Implement URLSearchParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More tests + ref count unattached URLSearchParams objects Created 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <link rel="help" href="http://url.spec.whatwg.org/#interface-urlsearchparams">
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script>
6 if (!window.gc)
7 {
8 window.gc = function() {
9 if (window.GCController)
10 return GCController.collect();
11 for (var i = 0; i < 10000; i++)
12 var s = new String("abc");
13 }
14 }
15
16 test(function() {
17 assert_true("URLSearchParams" in window);
18 assert_true("toString" in URLSearchParams.prototype);
19 assert_true("append" in URLSearchParams.prototype);
20 assert_true("delete" in URLSearchParams.prototype);
21 assert_true("get" in URLSearchParams.prototype);
22 assert_true("getAll" in URLSearchParams.prototype);
23 assert_true("has" in URLSearchParams.prototype);
24 assert_true("set" in URLSearchParams.prototype);
25 }, "URLSearchParams interface");
26
27 test(function() {
28 // Exercise handling of reference counting. Pass if no crash.
29 var u1 = new URLSearchParams("a=b&c=d");
30 u1 = null;
31 gc();
32 // Expect 'u' gone.
33
34 var u2 = new URLSearchParams("a=b&c=d");
35 var url2 = new URL("http://example.org/file?a=b&c=d");
36 // Creates and returns an URLSearchParams.
37 url2.searchParams;
38 url2.searchParams = u2;
39 u2 = null;
40 gc();
41 // Expect url2's original searchParams + u2 gone.
42
43 url2.searchParams = new URLSearchParams();
44 gc();
45 // Expect u2's original searchParams gone.
46 url2 = null;
47
48 var url3 = new URL("http://example.org/file?a=b&c=d");
49 var u3 = new URLSearchParams();
50 url3.searchParams = u3;
51 url3.searchParams = u3;
52 gc();
53 url3 = u3 = null;
54 gc();
55 }, "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 +
56 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698