From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- dom/url/tests/browser.ini | 5 + dom/url/tests/browser_download_after_revoke.js | 53 +++ dom/url/tests/chrome.ini | 12 + dom/url/tests/empty.html | 2 + dom/url/tests/file_url.jsm | 22 ++ dom/url/tests/file_worker_url.jsm | 26 ++ dom/url/tests/jsm_url_worker.js | 83 +++++ dom/url/tests/mochitest.ini | 21 ++ dom/url/tests/test_bloburl_location.html | 31 ++ dom/url/tests/test_bug883784.jsm | 42 +++ dom/url/tests/test_bug883784.xul | 36 ++ dom/url/tests/test_unknown_url_origin.html | 17 + dom/url/tests/test_url.html | 442 +++++++++++++++++++++++++ dom/url/tests/test_url.xul | 26 ++ dom/url/tests/test_urlExceptions.html | 57 ++++ dom/url/tests/test_urlSearchParams.html | 334 +++++++++++++++++++ dom/url/tests/test_urlSearchParams_utf8.html | 40 +++ dom/url/tests/test_url_data.html | 37 +++ dom/url/tests/test_url_empty_port.html | 53 +++ dom/url/tests/test_url_malformedHost.html | 48 +++ dom/url/tests/test_urlutils_stringify.html | 38 +++ dom/url/tests/test_worker_url.html | 67 ++++ dom/url/tests/test_worker_url.xul | 35 ++ dom/url/tests/test_worker_urlApi.html | 45 +++ dom/url/tests/test_worker_urlSearchParams.html | 43 +++ dom/url/tests/test_worker_url_exceptions.html | 44 +++ dom/url/tests/urlApi_worker.js | 272 +++++++++++++++ dom/url/tests/urlSearchParams_worker.js | 162 +++++++++ dom/url/tests/url_exceptions_worker.js | 38 +++ dom/url/tests/url_worker.js | 91 +++++ 30 files changed, 2222 insertions(+) create mode 100644 dom/url/tests/browser.ini create mode 100644 dom/url/tests/browser_download_after_revoke.js create mode 100644 dom/url/tests/chrome.ini create mode 100644 dom/url/tests/empty.html create mode 100644 dom/url/tests/file_url.jsm create mode 100644 dom/url/tests/file_worker_url.jsm create mode 100644 dom/url/tests/jsm_url_worker.js create mode 100644 dom/url/tests/mochitest.ini create mode 100644 dom/url/tests/test_bloburl_location.html create mode 100644 dom/url/tests/test_bug883784.jsm create mode 100644 dom/url/tests/test_bug883784.xul create mode 100644 dom/url/tests/test_unknown_url_origin.html create mode 100644 dom/url/tests/test_url.html create mode 100644 dom/url/tests/test_url.xul create mode 100644 dom/url/tests/test_urlExceptions.html create mode 100644 dom/url/tests/test_urlSearchParams.html create mode 100644 dom/url/tests/test_urlSearchParams_utf8.html create mode 100644 dom/url/tests/test_url_data.html create mode 100644 dom/url/tests/test_url_empty_port.html create mode 100644 dom/url/tests/test_url_malformedHost.html create mode 100644 dom/url/tests/test_urlutils_stringify.html create mode 100644 dom/url/tests/test_worker_url.html create mode 100644 dom/url/tests/test_worker_url.xul create mode 100644 dom/url/tests/test_worker_urlApi.html create mode 100644 dom/url/tests/test_worker_urlSearchParams.html create mode 100644 dom/url/tests/test_worker_url_exceptions.html create mode 100644 dom/url/tests/urlApi_worker.js create mode 100644 dom/url/tests/urlSearchParams_worker.js create mode 100644 dom/url/tests/url_exceptions_worker.js create mode 100644 dom/url/tests/url_worker.js (limited to 'dom/url/tests') diff --git a/dom/url/tests/browser.ini b/dom/url/tests/browser.ini new file mode 100644 index 000000000..ad58be903 --- /dev/null +++ b/dom/url/tests/browser.ini @@ -0,0 +1,5 @@ +[DEFAULT] +support-files = + empty.html + +[browser_download_after_revoke.js] diff --git a/dom/url/tests/browser_download_after_revoke.js b/dom/url/tests/browser_download_after_revoke.js new file mode 100644 index 000000000..3e521eafe --- /dev/null +++ b/dom/url/tests/browser_download_after_revoke.js @@ -0,0 +1,53 @@ +function test () { + waitForExplicitFinish(); + gBrowser.selectedTab = gBrowser.addTab(); + + function onLoad() { + info("Page loaded."); + gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); + + var listener = { + onOpenWindow: function(aXULWindow) { + info("Download window shown..."); + Services.wm.removeListener(listener); + + function downloadOnLoad() { + domwindow.removeEventListener("load", downloadOnLoad, true); + + is(domwindow.document.location.href, "chrome://mozapps/content/downloads/unknownContentType.xul", "Download page appeared"); + + domwindow.close(); + gBrowser.removeTab(gBrowser.selectedTab); + finish(); + } + + var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindow); + domwindow.addEventListener("load", downloadOnLoad, true); + }, + onCloseWindow: function(aXULWindow) {}, + onWindowTitleChange: function(aXULWindow, aNewTitle) {} + } + + Services.wm.addListener(listener); + + info("Creating BlobURL and clicking on a HTMLAnchorElement..."); + ContentTask.spawn(gBrowser.selectedBrowser, null, function() { + let blob = new content.Blob(['test'], { type: 'text/plain' }); + let url = content.URL.createObjectURL(blob); + + let link = content.document.createElement('a'); + link.href = url; + link.download = 'example.txt'; + content.document.body.appendChild(link); + link.click(); + + content.URL.revokeObjectURL(url); + }); + } + + gBrowser.selectedBrowser.addEventListener("load", onLoad, true); + + info("Loading download page..."); + content.location = "http://example.com/browser/dom/url/tests/empty.html"; +} diff --git a/dom/url/tests/chrome.ini b/dom/url/tests/chrome.ini new file mode 100644 index 000000000..256fda02b --- /dev/null +++ b/dom/url/tests/chrome.ini @@ -0,0 +1,12 @@ +[DEFAULT] +skip-if = os == 'android' +support-files = + file_url.jsm + file_worker_url.jsm + test_bug883784.jsm + jsm_url_worker.js + !/dom/workers/test/dom_worker_helper.js + +[test_bug883784.xul] +[test_url.xul] +[test_worker_url.xul] diff --git a/dom/url/tests/empty.html b/dom/url/tests/empty.html new file mode 100644 index 000000000..358db717d --- /dev/null +++ b/dom/url/tests/empty.html @@ -0,0 +1,2 @@ + + diff --git a/dom/url/tests/file_url.jsm b/dom/url/tests/file_url.jsm new file mode 100644 index 000000000..a90f8c95d --- /dev/null +++ b/dom/url/tests/file_url.jsm @@ -0,0 +1,22 @@ +this.EXPORTED_SYMBOLS = ['checkFromJSM']; + +this.checkFromJSM = function checkFromJSM(ok, is) { + Components.utils.importGlobalProperties(['URL', 'Blob']); + + var url = new URL('http://www.example.com'); + is(url.href, "http://www.example.com/", "JSM should have URL"); + + var url2 = new URL('/foobar', url); + is(url2.href, "http://www.example.com/foobar", "JSM should have URL - based on another URL"); + + var blob = new Blob(['a']); + var url = URL.createObjectURL(blob); + ok(url, "URL is created!"); + + var u = new URL(url); + ok(u, "URL created"); + is(u.origin, "null", "Url doesn't have an origin if created in a JSM"); + + URL.revokeObjectURL(url); + ok(true, "URL is revoked"); +} diff --git a/dom/url/tests/file_worker_url.jsm b/dom/url/tests/file_worker_url.jsm new file mode 100644 index 000000000..d0bbf62fe --- /dev/null +++ b/dom/url/tests/file_worker_url.jsm @@ -0,0 +1,26 @@ +this.EXPORTED_SYMBOLS = ['checkFromJSM']; + +Components.utils.importGlobalProperties(['URL']); + +this.checkFromJSM = function checkFromJSM(ok, is, finish) { + let worker = new ChromeWorker("jsm_url_worker.js"); + worker.onmessage = function(event) { + + if (event.data.type == 'finish') { + finish(); + } else if (event.data.type == 'url') { + URL.revokeObjectURL(event.data.url); + } else if (event.data.type == 'status') { + ok(event.data.status, event.data.msg); + } + } + + worker.onerror = function(event) { + is(event.target, worker); + ok(false, "Worker had an error: " + event.data); + worker.terminate(); + finish(); + }; + + worker.postMessage(0); +} diff --git a/dom/url/tests/jsm_url_worker.js b/dom/url/tests/jsm_url_worker.js new file mode 100644 index 000000000..539ace40d --- /dev/null +++ b/dom/url/tests/jsm_url_worker.js @@ -0,0 +1,83 @@ +onmessage = function(event) { + if (event.data != 0) { + var worker = new Worker('jsm_url_worker.js'); + worker.onmessage = function(event) { + postMessage(event.data); + } + + worker.postMessage(event.data - 1); + return; + } + + status = false; + try { + if ((URL instanceof Object)) { + status = true; + } + } catch(e) { + } + + postMessage({type: 'status', status: status, msg: 'URL object:' + URL}); + + status = false; + var blob = null; + try { + blob = new Blob([]); + status = true; + } catch(e) { + } + + postMessage({type: 'status', status: status, msg: 'Blob:' + blob}); + + status = false; + var url = null; + try { + url = URL.createObjectURL(blob); + status = true; + } catch(e) { + } + + postMessage({type: 'status', status: status, msg: 'Blob URL:' + url}); + + status = false; + try { + URL.revokeObjectURL(url); + status = true; + } catch(e) { + } + + postMessage({type: 'status', status: status, msg: 'Blob Revoke URL'}); + + status = false; + var url = null; + try { + url = URL.createObjectURL(true); + } catch(e) { + status = true; + } + + postMessage({type: 'status', status: status, msg: 'CreateObjectURL should fail if the arg is not a blob'}); + + status = false; + var url = null; + try { + url = URL.createObjectURL(blob); + status = true; + } catch(e) { + } + + postMessage({type: 'status', status: status, msg: 'Blob URL2:' + url}); + + status = false; + try { + URL.createObjectURL(new Object()); + } catch(e) { + status = true; + } + + postMessage({type: 'status', status: status, msg: 'Exception wanted' }); + + postMessage({type: 'url', url: url}); + + postMessage({type: 'finish' }); +} diff --git a/dom/url/tests/mochitest.ini b/dom/url/tests/mochitest.ini new file mode 100644 index 000000000..3c641ba96 --- /dev/null +++ b/dom/url/tests/mochitest.ini @@ -0,0 +1,21 @@ +[DEFAULT] +support-files = + url_worker.js + urlApi_worker.js + urlSearchParams_worker.js + url_exceptions_worker.js + +[test_url.html] +[test_url_data.html] +[test_url_empty_port.html] +[test_url_malformedHost.html] +[test_urlExceptions.html] +[test_urlSearchParams.html] +[test_urlSearchParams_utf8.html] +[test_urlutils_stringify.html] +[test_worker_url.html] +[test_worker_urlApi.html] +[test_worker_url_exceptions.html] +[test_worker_urlSearchParams.html] +[test_unknown_url_origin.html] +[test_bloburl_location.html] diff --git a/dom/url/tests/test_bloburl_location.html b/dom/url/tests/test_bloburl_location.html new file mode 100644 index 000000000..3d190e125 --- /dev/null +++ b/dom/url/tests/test_bloburl_location.html @@ -0,0 +1,31 @@ + + + + + Test for blobURL in location + + + + + + + diff --git a/dom/url/tests/test_bug883784.jsm b/dom/url/tests/test_bug883784.jsm new file mode 100644 index 000000000..a5747817d --- /dev/null +++ b/dom/url/tests/test_bug883784.jsm @@ -0,0 +1,42 @@ +this.EXPORTED_SYMBOLS = ["Test"]; + +const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; +Cu.importGlobalProperties(["URL"]); + +this.Test = { + start: function(ok, is, finish) { + let worker = new ChromeWorker("jsm_url_worker.js"); + worker.onmessage = function(event) { + if (event.data.type == 'status') { + ok(event.data.status, event.data.msg); + } else if (event.data.type == 'url') { + var xhr = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] + .createInstance(Components.interfaces.nsIXMLHttpRequest); + xhr.open('GET', event.data.url, false); + xhr.onreadystatechange = function() { + if (xhr.readyState == 4) { + ok(true, "Blob readable!"); + URL.revokeObjectURL(event.data.url); + finish(); + } + } + xhr.onerror = function() { + ok(false, "Blob unreadable, should not happen!"); + URL.revokeObjectURL(event.data.url); + finish(); + } + xhr.send(); + } + }; + + var self = this; + worker.onerror = function(event) { + is(event.target, worker); + ok(false, "Worker had an error: " + event.data); + self.worker.terminate(); + finish(); + }; + + worker.postMessage(0); + } +}; diff --git a/dom/url/tests/test_bug883784.xul b/dom/url/tests/test_bug883784.xul new file mode 100644 index 000000000..4fdcf5eb1 --- /dev/null +++ b/dom/url/tests/test_bug883784.xul @@ -0,0 +1,36 @@ + + + + + + + +

+ +

+  
+  
diff --git a/dom/url/tests/test_unknown_url_origin.html b/dom/url/tests/test_unknown_url_origin.html new file mode 100644 index 000000000..052bb6ca4 --- /dev/null +++ b/dom/url/tests/test_unknown_url_origin.html @@ -0,0 +1,17 @@ + + + + + Test for unknwon URL.origin + + + + + + + diff --git a/dom/url/tests/test_url.html b/dom/url/tests/test_url.html new file mode 100644 index 000000000..3f3f727d6 --- /dev/null +++ b/dom/url/tests/test_url.html @@ -0,0 +1,442 @@ + + + + + Test URL API + + + + +Mozilla Bug 887364 +Mozilla Bug 991471 +Mozilla Bug 996055 +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + diff --git a/dom/url/tests/test_url.xul b/dom/url/tests/test_url.xul new file mode 100644 index 000000000..026e9df93 --- /dev/null +++ b/dom/url/tests/test_url.xul @@ -0,0 +1,26 @@ + + + + + + diff --git a/dom/url/tests/test_urlExceptions.html b/dom/url/tests/test_urlExceptions.html new file mode 100644 index 000000000..b75c9d114 --- /dev/null +++ b/dom/url/tests/test_urlExceptions.html @@ -0,0 +1,57 @@ + + + + + + Test for Bug 926890 + + + + +Mozilla Bug 926890 +

+ +
+
+ + + + diff --git a/dom/url/tests/test_urlSearchParams.html b/dom/url/tests/test_urlSearchParams.html new file mode 100644 index 000000000..d5a65e1c5 --- /dev/null +++ b/dom/url/tests/test_urlSearchParams.html @@ -0,0 +1,334 @@ + + + + + + + Test for URLSearchParams + + + + +Mozilla Bug 887836 +

+ +
+
+ + + diff --git a/dom/url/tests/test_urlSearchParams_utf8.html b/dom/url/tests/test_urlSearchParams_utf8.html new file mode 100644 index 000000000..22c85de45 --- /dev/null +++ b/dom/url/tests/test_urlSearchParams_utf8.html @@ -0,0 +1,40 @@ + + + + + + + Test for Bug 1032511 + + + + +Mozilla Bug 1032511 +

+ +
+
+foobar +foobar + + + diff --git a/dom/url/tests/test_url_data.html b/dom/url/tests/test_url_data.html new file mode 100644 index 000000000..082128f6d --- /dev/null +++ b/dom/url/tests/test_url_data.html @@ -0,0 +1,37 @@ + + + + + Test URL API - data:plain + + + + +Mozilla Bug 1018682 + + + + + diff --git a/dom/url/tests/test_url_empty_port.html b/dom/url/tests/test_url_empty_port.html new file mode 100644 index 000000000..f3169730c --- /dev/null +++ b/dom/url/tests/test_url_empty_port.html @@ -0,0 +1,53 @@ + + + + + + + Test for Bug 930450 + + + + +Mozilla Bug 930450 +

+ +
+
+ foobar + + + + diff --git a/dom/url/tests/test_url_malformedHost.html b/dom/url/tests/test_url_malformedHost.html new file mode 100644 index 000000000..5b813b817 --- /dev/null +++ b/dom/url/tests/test_url_malformedHost.html @@ -0,0 +1,48 @@ + + + + + + + Test for Bug 1020041 + + + + +Mozilla Bug 1020041 +

+ +
+
+ foobar + + + + diff --git a/dom/url/tests/test_urlutils_stringify.html b/dom/url/tests/test_urlutils_stringify.html new file mode 100644 index 000000000..a2b32d45f --- /dev/null +++ b/dom/url/tests/test_urlutils_stringify.html @@ -0,0 +1,38 @@ + + + + + + + Test for Bug 959190 + + + + +Mozilla Bug 959190 +

+ +
+
+ foobar + + + + diff --git a/dom/url/tests/test_worker_url.html b/dom/url/tests/test_worker_url.html new file mode 100644 index 000000000..6b010608c --- /dev/null +++ b/dom/url/tests/test_worker_url.html @@ -0,0 +1,67 @@ + + + + + Test for URL object in workers + + + + +

+ +

+
+
+
+
+
diff --git a/dom/url/tests/test_worker_url.xul b/dom/url/tests/test_worker_url.xul
new file mode 100644
index 000000000..2f4d79b2c
--- /dev/null
+++ b/dom/url/tests/test_worker_url.xul
@@ -0,0 +1,35 @@
+
+
+
+
+  
+
+  
+    

+ +

+  
+  
diff --git a/dom/url/tests/test_worker_urlApi.html b/dom/url/tests/test_worker_urlApi.html new file mode 100644 index 000000000..654d2a197 --- /dev/null +++ b/dom/url/tests/test_worker_urlApi.html @@ -0,0 +1,45 @@ + + + + + Test for URL API object in workers + + + + +

+ +

+
+
+
+
+
+
diff --git a/dom/url/tests/test_worker_urlSearchParams.html b/dom/url/tests/test_worker_urlSearchParams.html
new file mode 100644
index 000000000..7578d5c35
--- /dev/null
+++ b/dom/url/tests/test_worker_urlSearchParams.html
@@ -0,0 +1,43 @@
+
+
+
+
+  Test for URLSearchParams object in workers
+  
+  
+
+
+

+ +

+
+
+
+
diff --git a/dom/url/tests/test_worker_url_exceptions.html b/dom/url/tests/test_worker_url_exceptions.html
new file mode 100644
index 000000000..17993fe4d
--- /dev/null
+++ b/dom/url/tests/test_worker_url_exceptions.html
@@ -0,0 +1,44 @@
+
+
+
+
+  Test for URL exceptions in workers
+  
+  
+
+
+

+ +

+
+
+
+
+
+
diff --git a/dom/url/tests/urlApi_worker.js b/dom/url/tests/urlApi_worker.js
new file mode 100644
index 000000000..a8b88e046
--- /dev/null
+++ b/dom/url/tests/urlApi_worker.js
@@ -0,0 +1,272 @@
+function ok(a, msg) {
+  dump("OK: " + !!a + "  =>  " + a + " " + msg + "\n");
+  postMessage({type: 'status', status: !!a, msg: a + ": " + msg });
+}
+
+function is(a, b, msg) {
+  dump("IS: " + (a===b) + "  =>  " + a + " | " + b + " " + msg + "\n");
+  postMessage({type: 'status', status: a === b, msg: a + " === " + b + ": " + msg });
+}
+
+onmessage = function() {
+  status = false;
+  try {
+    if ((URL instanceof Object)) {
+      status = true;
+    }
+  } catch(e) {
+  }
+
+  var tests = [
+    { url: 'http://www.abc.com',
+      base: undefined,
+      error: false,
+      href: 'http://www.abc.com/',
+      origin: 'http://www.abc.com',
+      protocol: 'http:',
+      username: '',
+      password: '',
+      host: 'www.abc.com',
+      hostname: 'www.abc.com',
+      port: '',
+      pathname: '/',
+      search: '',
+      hash: ''
+    },
+    { url: 'ftp://auser:apw@www.abc.com',
+      base: undefined,
+      error: false,
+      href: 'ftp://auser:apw@www.abc.com/',
+      origin: 'ftp://www.abc.com',
+      protocol: 'ftp:',
+      username: 'auser',
+      password: 'apw',
+      host: 'www.abc.com',
+      hostname: 'www.abc.com',
+      port: '',
+      pathname: '/',
+      search: '',
+      hash: ''
+    },
+    { url: 'http://www.abc.com:90/apath/',
+      base: undefined,
+      error: false,
+      href: 'http://www.abc.com:90/apath/',
+      origin: 'http://www.abc.com:90',
+      protocol: 'http:',
+      username: '',
+      password: '',
+      host: 'www.abc.com:90',
+      hostname: 'www.abc.com',
+      port: '90',
+      pathname: '/apath/',
+      search: '',
+      hash: ''
+    },
+    { url: 'http://www.abc.com/apath/afile.txt#ahash',
+      base: undefined,
+      error: false,
+      href: 'http://www.abc.com/apath/afile.txt#ahash',
+      origin: 'http://www.abc.com',
+      protocol: 'http:',
+      username: '',
+      password: '',
+      host: 'www.abc.com',
+      hostname: 'www.abc.com',
+      port: '',
+      pathname: '/apath/afile.txt',
+      search: '',
+      hash: '#ahash'
+    },
+    { url: 'http://example.com/?test#hash',
+      base: undefined,
+      error: false,
+      href: 'http://example.com/?test#hash',
+      origin: 'http://example.com',
+      protocol: 'http:',
+      username: '',
+      password: '',
+      host: 'example.com',
+      hostname: 'example.com',
+      port: '',
+      pathname: '/',
+      search: '?test',
+      hash: '#hash'
+    },
+    { url: 'http://example.com/?test',
+      base: undefined,
+      error: false,
+      href: 'http://example.com/?test',
+      origin: 'http://example.com',
+      protocol: 'http:',
+      username: '',
+      password: '',
+      host: 'example.com',
+      hostname: 'example.com',
+      port: '',
+      pathname: '/',
+      search: '?test',
+      hash: ''
+    },
+    { url: 'http://example.com/carrot#question%3f',
+      base: undefined,
+      error: false,
+      hash: '#question%3f'
+    },
+    { url: 'https://example.com:4443?',
+      base: undefined,
+      error: false,
+      protocol: 'https:',
+      port: '4443',
+      pathname: '/',
+      hash: '',
+      search: ''
+    },
+    { url: 'http://www.abc.com/apath/afile.txt#ahash?asearch',
+      base: undefined,
+      error: false,
+      href: 'http://www.abc.com/apath/afile.txt#ahash?asearch',
+      protocol: 'http:',
+      pathname: '/apath/afile.txt',
+      hash: '#ahash?asearch',
+      search: ''
+    },
+    { url: 'http://www.abc.com/apath/afile.txt?asearch#ahash',
+      base: undefined,
+      error: false,
+      href: 'http://www.abc.com/apath/afile.txt?asearch#ahash',
+      protocol: 'http:',
+      pathname: '/apath/afile.txt',
+      hash: '#ahash',
+      search: '?asearch'
+    },
+    { url: 'http://abc.com/apath/afile.txt?#ahash',
+      base: undefined,
+      error: false,
+      pathname: '/apath/afile.txt',
+      hash: '#ahash',
+      search: ''
+    },
+    { url: 'http://auser:apassword@www.abc.com:90/apath/afile.txt?asearch#ahash',
+      base: undefined,
+      error: false,
+      protocol: 'http:',
+      username: 'auser',
+      password: 'apassword',
+      host: 'www.abc.com:90',
+      hostname: 'www.abc.com',
+      port: '90',
+      pathname: '/apath/afile.txt',
+      hash: '#ahash',
+      search: '?asearch',
+      origin: 'http://www.abc.com:90'
+    },
+
+    { url: '/foo#bar',
+      base: 'www.test.org',
+      error: true,
+    },
+    { url: '/foo#bar',
+      base: null,
+      error: true,
+    },
+    { url: '/foo#bar',
+      base: 42,
+      error: true,
+    },
+    { url: 'ftp://ftp.something.net',
+      base: undefined,
+      error: false,
+      protocol: 'ftp:',
+    },
+    { url: 'file:///tmp/file',
+      base: undefined,
+      error: false,
+      protocol: 'file:',
+    },
+    { url: 'gopher://gopher.something.net',
+      base: undefined,
+      error: false,
+      protocol: 'gopher:',
+    },
+    { url: 'ws://ws.something.net',
+      base: undefined,
+      error: false,
+      protocol: 'ws:',
+    },
+    { url: 'wss://ws.something.net',
+      base: undefined,
+      error: false,
+      protocol: 'wss:',
+    },
+    { url: 'foo://foo.something.net',
+      base: undefined,
+      error: false,
+      protocol: 'foo:',
+    },
+  ];
+
+  while(tests.length) {
+    var test = tests.shift();
+
+    var error = false;
+    var url;
+    try {
+      if (test.base) {
+        url = new URL(test.url, test.base);
+      } else {
+        url = new URL(test.url);
+      }
+    } catch(e) {
+      error = true;
+    }
+
+    is(test.error, error, "Error creating URL");
+    if (test.error) {
+      continue;
+    }
+
+    if ('href' in test) is(url.href, test.href, "href");
+    if ('origin' in test) is(url.origin, test.origin, "origin");
+    if ('protocol' in test) is(url.protocol, test.protocol, "protocol");
+    if ('username' in test) is(url.username, test.username, "username");
+    if ('password' in test) is(url.password, test.password, "password");
+    if ('host' in test) is(url.host, test.host, "host");
+    if ('hostname' in test) is(url.hostname, test.hostname, "hostname");
+    if ('port' in test) is(url.port, test.port, "port");
+    if ('pathname' in test) is(url.pathname, test.pathname, "pathname");
+    if ('search' in test) is(url.search, test.search, "search");
+    if ('hash' in test) is(url.hash, test.hash, "hash");
+
+    url = new URL('https://www.example.net/what#foo?bar');
+    ok(url, "Url exists!");
+
+    if ('href' in test) url.href = test.href;
+    if ('protocol' in test) url.protocol = test.protocol;
+    if ('username' in test && test.username) url.username = test.username;
+    if ('password' in test && test.password) url.password = test.password;
+    if ('host' in test) url.host = test.host;
+    if ('hostname' in test) url.hostname = test.hostname;
+    if ('port' in test) url.port = test.port;
+    if ('pathname' in test) url.pathname = test.pathname;
+    if ('search' in test) url.search = test.search;
+    if ('hash' in test) url.hash = test.hash;
+
+    if ('href' in test) is(url.href, test.href, "href");
+    if ('origin' in test) is(url.origin, test.origin, "origin");
+    if ('protocol' in test) is(url.protocol, test.protocol, "protocol");
+    if ('username' in test) is(url.username, test.username, "username");
+    if ('password' in test) is(url.password, test.password, "password");
+    if ('host' in test) is(url.host, test.host, "host");
+    if ('hostname' in test) is(test.hostname, url.hostname, "hostname");
+    if ('port' in test) is(test.port, url.port, "port");
+    if ('pathname' in test) is(test.pathname, url.pathname, "pathname");
+    if ('search' in test) is(test.search, url.search, "search");
+    if ('hash' in test) is(test.hash, url.hash, "hash");
+
+    if ('href' in test) is (test.href, url + '', 'stringify works');
+  }
+
+  postMessage({type: 'finish' });
+}
+
diff --git a/dom/url/tests/urlSearchParams_worker.js b/dom/url/tests/urlSearchParams_worker.js
new file mode 100644
index 000000000..03b104f3f
--- /dev/null
+++ b/dom/url/tests/urlSearchParams_worker.js
@@ -0,0 +1,162 @@
+function ok(a, msg) {
+  dump("OK: " + !!a + "  =>  " + a + " " + msg + "\n");
+  postMessage({type: 'status', status: !!a, msg: a + ": " + msg });
+}
+
+function is(a, b, msg) {
+  dump("IS: " + (a===b) + "  =>  " + a + " | " + b + " " + msg + "\n");
+  postMessage({type: 'status', status: a === b, msg: a + " === " + b + ": " + msg });
+}
+
+onmessage = function() {
+  status = false;
+  try {
+    if ((URLSearchParams instanceof Object)) {
+      status = true;
+    }
+  } catch(e) {
+  }
+  ok(status, "URLSearchParams in workers \\o/");
+
+  function testSimpleURLSearchParams() {
+    var u = new URLSearchParams();
+    ok(u, "URLSearchParams created");
+    is(u.has('foo'), false, 'URLSearchParams.has(foo)');
+    is(u.get('foo'), null, 'URLSearchParams.get(foo)');
+    is(u.getAll('foo').length, 0, 'URLSearchParams.getAll(foo)');
+
+    u.append('foo', 'bar');
+    is(u.has('foo'), true, 'URLSearchParams.has(foo)');
+    is(u.get('foo'), 'bar', 'URLSearchParams.get(foo)');
+    is(u.getAll('foo').length, 1, 'URLSearchParams.getAll(foo)');
+
+    u.set('foo', 'bar2');
+    is(u.get('foo'), 'bar2', 'URLSearchParams.get(foo)');
+    is(u.getAll('foo').length, 1, 'URLSearchParams.getAll(foo)');
+
+    is(u + "", "foo=bar2", "stringify");
+
+    u.delete('foo');
+
+    runTest();
+  }
+
+  function testCopyURLSearchParams() {
+    var u = new URLSearchParams();
+    ok(u, "URLSearchParams created");
+    u.append('foo', 'bar');
+
+    var uu = new URLSearchParams(u);
+    is(uu.get('foo'), 'bar', 'uu.get()');
+
+    u.append('foo', 'bar2');
+    is(u.getAll('foo').length, 2, "u.getAll()");
+    is(uu.getAll('foo').length, 1, "uu.getAll()");
+
+    runTest();
+  }
+
+  function testParserURLSearchParams() {
+    var checks = [
+      { input: '', data: {} },
+      { input: 'a', data: { 'a' : [''] } },
+      { input: 'a=b', data: { 'a' : ['b'] } },
+      { input: 'a=', data: { 'a' : [''] } },
+      { input: '=b', data: { '' : ['b'] } },
+      { input: '&', data: {} },
+      { input: '&a', data: { 'a' : [''] } },
+      { input: 'a&', data: { 'a' : [''] } },
+      { input: 'a&a', data: { 'a' : ['', ''] } },
+      { input: 'a&b&c', data: { 'a' : [''], 'b' : [''], 'c' : [''] } },
+      { input: 'a=b&c=d', data: { 'a' : ['b'], 'c' : ['d'] } },
+      { input: 'a=b&c=d&', data: { 'a' : ['b'], 'c' : ['d'] } },
+      { input: '&&&a=b&&&&c=d&', data: { 'a' : ['b'], 'c' : ['d'] } },
+      { input: 'a=a&a=b&a=c', data: { 'a' : ['a', 'b', 'c'] } },
+      { input: 'a==a', data: { 'a' : ['=a'] } },
+      { input: 'a=a+b+c+d', data: { 'a' : ['a b c d'] } },
+      { input: '%=a', data: { '%' : ['a'] } },
+      { input: '%a=a', data: { '%a' : ['a'] } },
+      { input: '%a_=a', data: { '%a_' : ['a'] } },
+      { input: '%61=a', data: { 'a' : ['a'] } },
+      { input: '%=a', data: { '%' : ['a'] } },
+      { input: '%a=a', data: { '%a' : ['a'] } },
+      { input: '%a_=a', data: { '%a_' : ['a'] } },
+      { input: '%61=a', data: { 'a' : ['a'] } },
+      { input: '%61+%4d%4D=', data: { 'a MM' : [''] } },
+      { input: '?a=1', data: { 'a' : ['1'] } },
+      { input: '?', data: {} },
+      { input: '?=b', data: { '' : ['b'] } },
+    ];
+
+    for (var i = 0; i < checks.length; ++i) {
+      var u = new URLSearchParams(checks[i].input);
+
+      var count = 0;
+      for (var key in checks[i].data) {
+        ++count;
+        ok(u.has(key), "key " + key + " found");
+
+        var all = u.getAll(key);
+        is(all.length, checks[i].data[key].length, "same number of elements");
+
+        for (var k = 0; k < all.length; ++k) {
+          is(all[k], checks[i].data[key][k], "value matches");
+        }
+      }
+    }
+
+    runTest();
+  }
+
+  function testURL() {
+    var url = new URL('http://www.example.net?a=b&c=d');
+    ok(url.searchParams, "URL searchParams exists!");
+    ok(url.searchParams.has('a'), "URL.searchParams.has('a')");
+    is(url.searchParams.get('a'), 'b', "URL.searchParams.get('a')");
+    ok(url.searchParams.has('c'), "URL.searchParams.has('c')");
+    is(url.searchParams.get('c'), 'd', "URL.searchParams.get('c')");
+
+    url.searchParams.set('e', 'f');
+    ok(url.href.indexOf('e=f') != 1, 'URL right');
+
+    runTest();
+  }
+
+  function testEncoding() {
+    var encoding = [ [ '1', '1' ],
+                     [ 'a b', 'a+b' ],
+                     [ '<>', '%3C%3E' ],
+                     [ '\u0541', '%D5%81'] ];
+
+    for (var i = 0; i < encoding.length; ++i) {
+      var url = new URL('http://www.example.net');
+      url.searchParams.set('a', encoding[i][0]);
+      is(url.href, 'http://www.example.net/?a=' + encoding[i][1]);
+
+      var url2 = new URL(url.href);
+      is(url2.searchParams.get('a'), encoding[i][0], 'a is still there');
+    }
+
+    runTest();
+  }
+
+  var tests = [
+    testSimpleURLSearchParams,
+    testCopyURLSearchParams,
+    testParserURLSearchParams,
+    testURL,
+    testEncoding,
+  ];
+
+  function runTest() {
+    if (!tests.length) {
+      postMessage({type: 'finish' });
+      return;
+    }
+
+    var test = tests.shift();
+    test();
+  }
+
+  runTest();
+}
diff --git a/dom/url/tests/url_exceptions_worker.js b/dom/url/tests/url_exceptions_worker.js
new file mode 100644
index 000000000..caefc2202
--- /dev/null
+++ b/dom/url/tests/url_exceptions_worker.js
@@ -0,0 +1,38 @@
+function ok(a, msg) {
+  postMessage({type: 'status', status: !!a, msg: msg });
+}
+
+onmessage = function(event) {
+  // URL.href throws
+  var url = new URL('http://www.example.com');
+  ok(url, "URL created");
+
+  var status = false;
+  try {
+    url.href = '42';
+  } catch(e) {
+    status = true;
+  }
+  ok(status, "url.href = 42 should throw");
+
+  url.href = 'http://www.example.org';
+  ok(true, "url.href should not throw");
+
+  status = false
+  try {
+    new URL('42');
+  } catch(e) {
+    status = true;
+  }
+  ok(status, "new URL(42) should throw");
+
+  status = false
+  try {
+    new URL('http://www.example.com', '42');
+  } catch(e) {
+    status = true;
+  }
+  ok(status, "new URL(something, 42) should throw");
+
+  postMessage({type: 'finish' });
+}
diff --git a/dom/url/tests/url_worker.js b/dom/url/tests/url_worker.js
new file mode 100644
index 000000000..2127acee7
--- /dev/null
+++ b/dom/url/tests/url_worker.js
@@ -0,0 +1,91 @@
+onmessage = function(event) {
+  if (event.data != 0) {
+    var worker = new Worker('url_worker.js');
+    worker.onmessage = function(event) {
+      postMessage(event.data);
+    }
+
+    worker.postMessage(event.data - 1);
+    return;
+  }
+
+  status = false;
+  try {
+    if ((URL instanceof Object)) {
+      status = true;
+    }
+  } catch(e) {
+  }
+
+  postMessage({type: 'status', status: status, msg: 'URL object:' + URL});
+
+  status = false;
+  var blob = null;
+  try {
+    blob = new Blob([]);
+    status = true;
+  } catch(e) {
+  }
+
+  postMessage({type: 'status', status: status, msg: 'Blob:' + blob});
+
+  status = false;
+  var url = null;
+  try {
+    url = URL.createObjectURL(blob);
+    status = true;
+  } catch(e) {
+  }
+
+  postMessage({type: 'status', status: status, msg: 'Blob URL:' + url});
+
+  status = false;
+  try {
+    URL.revokeObjectURL(url);
+    status = true;
+  } catch(e) {
+  }
+
+  postMessage({type: 'status', status: status, msg: 'Blob Revoke URL'});
+
+  status = false;
+  var url = null;
+  try {
+    url = URL.createObjectURL(true);
+  } catch(e) {
+    status = true;
+  }
+
+  postMessage({type: 'status', status: status, msg: 'CreateObjectURL should fail if the arg is not a blob'});
+
+  status = false;
+  var url = null;
+  try {
+    url = URL.createObjectURL(blob);
+    status = true;
+  } catch(e) {
+  }
+
+  postMessage({type: 'status', status: status, msg: 'Blob URL2:' + url});
+  postMessage({type: 'url', url: url});
+
+  status = false;
+  try {
+    URL.createObjectURL(new Object());
+  } catch(e) {
+    status = true;
+  }
+
+  postMessage({type: 'status', status: status, msg: 'Exception wanted' });
+
+  var blob = new Blob([123]);
+  var uri = URL.createObjectURL(blob);
+  postMessage({type: 'status', status: !!uri,
+               msg: "The URI has been generated from the blob"});
+
+  var u = new URL(uri);
+  postMessage({type: 'status', status: u.origin == 'http://mochi.test:8888',
+               msg: "The URL generated from a blob URI has an origin."});
+
+  postMessage({type: 'finish' });
+}
-- 
cgit v1.2.3