Bug 1160890 - Part 1: Remove unneeded code from ImportScripts(). r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 14 Jul 2015 16:08:36 +0100
changeset 252902 22e8c544040543b89df9c046079553f861faf846
parent 252901 de3fb216f066feea0024104288db95b97e514b39
child 252903 37c0bb092ec2b3812f095d02755d708638861906
push id29048
push userryanvm@gmail.com
push dateWed, 15 Jul 2015 03:36:39 +0000
treeherdermozilla-central@892594bdad30 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1160890
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1160890 - Part 1: Remove unneeded code from ImportScripts(). r=smaug
dom/workers/ScriptLoader.cpp
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -61,17 +61,16 @@
 #define MAX_CONCURRENT_SCRIPTS 1000
 
 USING_WORKERS_NAMESPACE
 
 using mozilla::dom::cache::Cache;
 using mozilla::dom::cache::CacheStorage;
 using mozilla::dom::Promise;
 using mozilla::dom::PromiseNativeHandler;
-using mozilla::dom::workers::exceptions::ThrowDOMExceptionForNSResult;
 using mozilla::ErrorResult;
 using mozilla::ipc::PrincipalInfo;
 using mozilla::UniquePtr;
 
 namespace {
 
 nsIURI*
 GetBaseURI(bool aIsMainScript, WorkerPrivate* aWorkerPrivate)
@@ -146,23 +145,16 @@ ChannelFromScriptURL(nsIPrincipal* princ
     bool isResource = false;
     NS_ENSURE_SUCCESS(uri->SchemeIs("resource", &isResource),
                       NS_ERROR_DOM_SECURITY_ERR);
 
     if (!isChrome && !isResource) {
       return NS_ERROR_DOM_SECURITY_ERR;
     }
   } else if (aIsMainScript) {
-    // If this script loader is being used to make a new worker then we need
-    // to do a same-origin check. Otherwise we need to clear the load with the
-    // security manager.
-    nsCString scheme;
-    rv = uri->GetScheme(scheme);
-    NS_ENSURE_SUCCESS(rv, rv);
-
     // We pass true as the 3rd argument to checkMayLoad here.
     // This allows workers in sandboxed documents to load data URLs
     // (and other URLs that inherit their principal from their
     // creator.)
     rv = principal->CheckMayLoad(uri, false, true);
     NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_SECURITY_ERR);
   }
   else {
@@ -1562,17 +1554,17 @@ CacheScriptLoader::OnStreamComplete(nsIS
   mLoadInfo.mCacheStatus = ScriptLoadInfo::Cached;
 
   MOZ_ASSERT(mPrincipalInfo);
   mRunnable->DataReceivedFromCache(mIndex, aString, aStringLen, mChannelInfo,
                                    Move(mPrincipalInfo));
   return NS_OK;
 }
 
- class ChannelGetterRunnable final : public nsRunnable
+class ChannelGetterRunnable final : public nsRunnable
 {
   WorkerPrivate* mParentWorker;
   nsCOMPtr<nsIEventTarget> mSyncLoopTarget;
   const nsAString& mScriptURL;
   nsIChannel** mChannel;
   nsresult mResult;
 
 public: