summaryrefslogtreecommitdiffstats
path: root/netwerk/test/TestURLManipulation.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /netwerk/test/TestURLManipulation.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'netwerk/test/TestURLManipulation.html')
-rw-r--r--netwerk/test/TestURLManipulation.html130
1 files changed, 130 insertions, 0 deletions
diff --git a/netwerk/test/TestURLManipulation.html b/netwerk/test/TestURLManipulation.html
new file mode 100644
index 000000000..fd58652b7
--- /dev/null
+++ b/netwerk/test/TestURLManipulation.html
@@ -0,0 +1,130 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title>URL manipulation</title>
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+
+ <script type="text/javascript">
+ var gIOService = null;
+ function getIOService()
+ {
+ if (gIOService)
+ return gIOService;
+
+ try {
+ gIOService = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService);
+ } catch(e) { dump("problem creating nsIURL for: "+inURLString+"\n"); }
+
+ return gIOService;
+ }
+
+ function getnsIURL(inURLString)
+ {
+ var URL = null;
+ var ioserv = getIOService();
+ try {
+ var URI = ioserv.newURI(inURLString, "", null);
+ URL = URI.QueryInterface(Components.interfaces.nsIURL);
+ } catch(e) { dump("problem creating nsIURL for: "+inURLString+"\n"); }
+ return URL;
+ }
+
+ function getCommonSpec()
+ {
+ var URL1 = getnsIURL(document.foo.baseEdit.value);
+ var URL2 = getnsIURL(document.foo.compareEdit.value);
+ var result = "";
+ try {
+ result = URL1.getCommonBaseSpec(URL2);
+ } catch(e) { dump("problem with getCommonSpec ("+e+")\n"); }
+ document.foo.resultEdit.value = result;
+ }
+
+ function getRelativeSpec()
+ {
+ var URL1 = getnsIURL(document.foo.baseEdit.value);
+ var URL2 = getnsIURL(document.foo.compareEdit.value);
+ var result = "";
+ try {
+ result = URL1.getRelativeSpec(URL2);
+ } catch(e) { dump("problem with getRelativeSpec ("+e+")\n"); }
+ document.foo.resultEdit.value = result;
+ }
+
+ function doResolve()
+ {
+ var URL = getnsIURL(document.foo.baseEdit.value);
+ var result = "";
+ try {
+ result = URL.resolve(document.foo.resultEdit.value);
+ } catch(e) { dump("problem with getRelativeSpec ("+e+")\n"); }
+ document.foo.compareEdit.value = result;
+ }
+ </script>
+</head>
+<body>
+<h1>testing of URL manipulation:</h1>
+<p>
+ <form name="foo">
+ <p>
+ <label for="baseEdit">base url (absolute)</label><br>
+ <input type="input" name="baseEdit" size="80" value="http://www.mozilla.org/">
+
+ <p>
+ <label for="compareEdit">comparison uri (absolute)</label><br>
+ <input type="input" name="compareEdit" size="80">
+
+ <p>
+ <label for="resultEdit">resolved url</label><br>
+ <input type="input" name="resultEdit" size="80">
+
+ <p>
+ <input type="button" onclick="getCommonSpec();" value="Get Common Spec">
+ <input type="button" onclick="getRelativeSpec();" value="Get Relative Spec">
+ <input type="button" onclick="doResolve();" value="Resolve">
+ <h5> note: results from "resolve" are placed in "comparison uri" edit field</h5>
+ </form>
+<p>
+<br>
+
+<h3>notes for testing</h3>
+different types of uris:<br>
+<ul>
+ <li>about:</li>
+ <li>about:blank</li>
+ <li>mailbox://nsmail-2.mcom.com/xxx</li>
+ <li>mailto:brade@netscape.com)</li>
+ <li>junk</li>
+ <li>http://foo/</li>
+ <li>http://foo.com/</li>
+ <li>https://foo.com/</li>
+ <li>ftp://ftp.mozilla.org/</li>
+ <li>http://foo.com:8080/</li>
+ <li>http://brade@foo.com/</li>
+ <li>http://brade:password@foo.com/</li>
+ <li>http://brade:@foo.com:8080/</li>
+ <li>file:///</li>
+ <li>file:///Quest/Desktop%20Folder/test.html</li>
+</ul>
+other variations:<br>
+<ul>
+ <li>sub-directories on above list</li>
+ <li>files on above list</li>
+ <li>sub-directories and files on above list<br>
+ </li>
+ <li>directories which don't end in a '/'</li>
+ <li>files with queries</li>
+ <li>files with no extension</li>
+ <li>files with references</li>
+ <li>files with params</li>
+ <li>other schemes (chrome, ldap, news, finger, etc.)<br>
+ </li>
+</ul>
+<br>
+This should be true:<br>
+&nbsp; resultString = baseURL.getRelativeSpec(URL);<br>
+&lt;==&gt;<br>
+&nbsp; baseURL.resolve(resultString) == URL.spec;<br>
+</body>
+</html>