diff --git a/caps/idl/nsIScriptSecurityManager.idl b/caps/idl/nsIScriptSecurityManager.idl index 1195ad5d7dc1..aa4bb778453e 100644 --- a/caps/idl/nsIScriptSecurityManager.idl +++ b/caps/idl/nsIScriptSecurityManager.idl @@ -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' * diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index d135d87c3a24..7350f3bfbf4d 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -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 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 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, diff --git a/content/base/src/contentAreaDropListener.js b/content/base/src/contentAreaDropListener.js index 870054f3e51b..964605267d82 100644 --- a/content/base/src/contentAreaDropListener.js +++ b/content/base/src/contentAreaDropListener.js @@ -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; }, diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index 2a52c57fd6e7..8d0ca1f4bd4a 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -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, diff --git a/js/xpconnect/shell/xpcshell.cpp b/js/xpconnect/shell/xpcshell.cpp index 5d6795d8e63a..d95594d782c8 100644 --- a/js/xpconnect/shell/xpcshell.cpp +++ b/js/xpconnect/shell/xpcshell.cpp @@ -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, diff --git a/toolkit/content/nsDragAndDrop.js b/toolkit/content/nsDragAndDrop.js index dfbe584ff6ea..bbf637706aef 100644 --- a/toolkit/content/nsDragAndDrop.js +++ b/toolkit/content/nsDragAndDrop.js @@ -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();