mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 327244 (1/2) - Remove nsIScriptSecurityManager::CheckLoadURIStr(). r=sicking
This commit is contained in:
parent
2864299ab6
commit
2b7700d07d
@ -112,15 +112,6 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager
|
||||
in AUTF8String uri,
|
||||
in unsigned long flags);
|
||||
|
||||
/**
|
||||
* Same as CheckLoadURI but takes string arguments for ease of use
|
||||
* by scripts
|
||||
*
|
||||
* @deprecated Use checkLoadURIStrWithPrincipal instead of this function.
|
||||
*/
|
||||
[deprecated] void checkLoadURIStr(in AUTF8String from, in AUTF8String uri,
|
||||
in unsigned long flags);
|
||||
|
||||
/**
|
||||
* Check that the function 'funObj' is allowed to run on 'targetObj'
|
||||
*
|
||||
|
@ -1587,30 +1587,6 @@ nsScriptSecurityManager::ReportError(JSContext* cx, const nsAString& messageTag,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::CheckLoadURIStr(const nsACString& aSourceURIStr,
|
||||
const nsACString& aTargetURIStr,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
// FIXME: bug 327244 -- this function should really die... Really truly.
|
||||
nsCOMPtr<nsIURI> source;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(source), aSourceURIStr,
|
||||
nsnull, nsnull, sIOService);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Note: this is not _quite_ right if aSourceURI has
|
||||
// NS_NULLPRINCIPAL_SCHEME, but we'll just extract the scheme in
|
||||
// CheckLoadURIWithPrincipal anyway, so this is good enough. This method
|
||||
// really needs to go away....
|
||||
nsCOMPtr<nsIPrincipal> sourcePrincipal;
|
||||
rv = CreateCodebasePrincipal(source,
|
||||
getter_AddRefs(sourcePrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return CheckLoadURIStrWithPrincipal(sourcePrincipal, aTargetURIStr,
|
||||
aFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aTargetURIStr,
|
||||
|
@ -66,12 +66,12 @@ ContentAreaDropListener.prototype =
|
||||
uriString = uriString.replace(/^\s*|\s*$/g, '');
|
||||
|
||||
let uri;
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
try {
|
||||
// Check that the uri is valid first and return an empty string if not.
|
||||
// It may just be plain text and should be ignored here
|
||||
uri = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService).
|
||||
newURI(uriString, null, null);
|
||||
uri = ioService.newURI(uriString, null, null);
|
||||
} catch (ex) { }
|
||||
if (!uri)
|
||||
return uriString;
|
||||
@ -85,10 +85,10 @@ ContentAreaDropListener.prototype =
|
||||
flags |= secMan.DISALLOW_INHERIT_PRINCIPAL;
|
||||
|
||||
// Use file:/// as the default uri so that drops of file URIs are always allowed
|
||||
if (sourceNode)
|
||||
secMan.checkLoadURIStrWithPrincipal(sourceNode.nodePrincipal, uriString, flags);
|
||||
else
|
||||
secMan.checkLoadURIStr("file:///", uriString, flags);
|
||||
let principal = sourceNode ? sourceNode.principal
|
||||
: secMan.getCodebasePrincipal(ioService.newURI("file:///", null, null));
|
||||
|
||||
secMan.checkLoadURIStrWithPrincipal(principal, uriString, flags);
|
||||
|
||||
return uriString;
|
||||
},
|
||||
|
@ -729,14 +729,6 @@ FullTrustSecMan::CheckLoadURIStrWithPrincipal(nsIPrincipal *aPrincipal,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::CheckLoadURIStr(const nsACString & from,
|
||||
const nsACString & uri,
|
||||
PRUint32 flags)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::CheckFunctionAccess(JSContext * cx,
|
||||
void * funObj,
|
||||
|
@ -1348,14 +1348,6 @@ FullTrustSecMan::CheckLoadURIStrWithPrincipal(nsIPrincipal *aPrincipal,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void checkLoadURIStr (in AUTF8String from, in AUTF8String uri, in unsigned long flags); */
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::CheckLoadURIStr(const nsACString & from,
|
||||
const nsACString & uri, PRUint32 flags)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] void checkFunctionAccess (in JSContextPtr cx, in voidPtr funObj, in voidPtr targetObj); */
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::CheckFunctionAccess(JSContext * cx, void * funObj,
|
||||
|
@ -565,11 +565,10 @@ var nsDragAndDrop = {
|
||||
aDraggedText = aDraggedText.replace(/^\s*|\s*$/g, '');
|
||||
|
||||
var uri;
|
||||
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
try {
|
||||
uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(aDraggedText, null, null);
|
||||
uri = ioService.newURI(aDraggedText, null, null);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
@ -588,11 +587,12 @@ var nsDragAndDrop = {
|
||||
var sourceDoc = aDragSession.sourceDocument;
|
||||
// Use "file:///" as the default sourceURI so that drops of file:// URIs
|
||||
// are always allowed.
|
||||
var sourceURI = sourceDoc ? sourceDoc.documentURI : "file:///";
|
||||
var principal = sourceDoc ? sourceDoc.nodePrincipal
|
||||
: secMan.getCodebasePrincipal(ioService.newURI("file:///", null, null));
|
||||
|
||||
try {
|
||||
secMan.checkLoadURIStr(sourceURI, aDraggedText,
|
||||
nsIScriptSecurityManager.STANDARD);
|
||||
secMan.checkLoadURIStrWithPrincipal(principal, aDraggedText,
|
||||
nsIScriptSecurityManager.STANDARD);
|
||||
} catch (e) {
|
||||
// Stop event propagation right here.
|
||||
aEvent.stopPropagation();
|
||||
|
Loading…
Reference in New Issue
Block a user