mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-14 03:30:17 +01:00
107 lines
2.1 KiB
Plaintext
107 lines
2.1 KiB
Plaintext
<HTML>
|
|
<HEAD>
|
|
<TITLE> Testing nsIURL Interface </TITLE>
|
|
<!--
|
|
Written by Dharma.
|
|
Tests last run on 05/25/01.
|
|
-->
|
|
|
|
<SCRIPT TYPE="text/javascript">
|
|
|
|
function getnsIURLObj()
|
|
{
|
|
// get an implementation of nsIURL.
|
|
try {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
var nsUrlObj = Components.classes["@mozilla.org/network/standard-url;1"].
|
|
createInstance(Components.interfaces.nsIURL);
|
|
}
|
|
catch(e) {
|
|
alert("Exception: " + e);
|
|
}
|
|
return nsUrlObj;
|
|
}
|
|
|
|
</SCRIPT>
|
|
|
|
</HEAD>
|
|
<BODY>
|
|
<SCRIPT TYPE="text/javascript">
|
|
var urlObj = getnsIURLObj();
|
|
|
|
try {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
urlObj.spec = "http://directory/newdir/fileBaseName.fileExtension?query";
|
|
|
|
// checking the filePath attribute.
|
|
/*
|
|
alert(urlObj.filePath);
|
|
urlObj.filePath = "/modifieddir/modifiedfile.ext";
|
|
alert(urlObj.spec);
|
|
*/
|
|
|
|
// checking param attribute.
|
|
/*
|
|
alert(urlObj.param);
|
|
urlObj.param = "newparam";
|
|
alert(urlObj.spec);
|
|
*/
|
|
|
|
// checking query attribute.
|
|
/*
|
|
alert(urlObj.query);
|
|
urlObj.query = "newquery";
|
|
alert(urlObj.spec);
|
|
*/
|
|
|
|
// checking ref attribute.
|
|
/*
|
|
alert(urlObj.ref);
|
|
urlObj.ref = "newref";
|
|
alert(urlObj.spec);
|
|
*/
|
|
|
|
// checking directory attribute
|
|
/*
|
|
alert(urlObj.directory);
|
|
urlObj.directory = "modifieddir";
|
|
alert(urlObj.spec);
|
|
*/
|
|
|
|
// checking fileName attribute.
|
|
/*
|
|
alert(urlObj.fileName);
|
|
urlObj.fileName = "newfilename";
|
|
alert(urlObj.spec);
|
|
*/
|
|
|
|
// checking fileBaseName attribute.
|
|
/*
|
|
alert(urlObj.fileBaseName);
|
|
urlObj.fileBaseName = "newfileBaseName";
|
|
alert(urlObj.spec);
|
|
*/
|
|
|
|
// checking fileExtension attribute.
|
|
/*
|
|
alert(urlObj.fileExtension);
|
|
urlObj.fileExtension = "newfileExtension";
|
|
alert(urlObj.spec);
|
|
*/
|
|
|
|
// checking escapedQuery attribute.
|
|
alert(urlObj.escapedQuery);
|
|
urlObj.escapedQuery = "escapedQuery";
|
|
alert(urlObj.spec);
|
|
|
|
}
|
|
catch(e) {
|
|
alert("Exception: " + e);
|
|
}
|
|
alert("END");
|
|
</SCRIPT>
|
|
|
|
</BODY>
|
|
</HTML> |