Index: chrome/test/data/media/html/utils.js |
diff --git a/chrome/test/data/media/html/utils.js b/chrome/test/data/media/html/utils.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2eded0387f470291fb623d5e3d46bff49bd45fee |
--- /dev/null |
+++ b/chrome/test/data/media/html/utils.js |
@@ -0,0 +1,29 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+// |
+// Miscellaneous utility functions for HTML media tests. Loading this script |
+// should not modify the page in any way. |
+// |
+ |
+var QueryString = function () { |
Ami GONE FROM CHROMIUM
2012/01/26 21:40:05
Is this any better than
function QueryString() {
DaleCurtis
2012/01/26 22:11:36
Yes, as that's not what QueryString contains. Quer
|
+ // Allows access to query parameters on the URL; e.g., given a URL like: |
+ // |
+ // http://<url>/my.html?test=123&bob=123 |
+ // |
+ // parameters can now be accessed via QueryString.test or QueryString.bob. |
+ var params = {}; |
+ |
+ // RegEx to split out values by &. |
+ var r = /([^&=]+)=?([^&]*)/g; |
+ |
+ // Lambda function for decoding extracted match values. Replaces '+' with |
+ // space so decodeURIComponent functions properly. |
+ function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); } |
+ |
+ var match; |
+ while (match = r.exec(window.location.search.substring(1))) |
+ params[d(match[1])] = d(match[2]); |
scherkus (not reviewing)
2012/01/26 21:52:16
nit: de-indent by 1 space
DaleCurtis
2012/01/26 22:11:36
Done.
|
+ |
+ return params; |
+} (); |