@@ -243,63 +243,7 @@ nsScriptSecurityManager::SecurityHashURI(nsIURI* aURI)
243243uint16_t
244244nsScriptSecurityManager::AppStatusForPrincipal (nsIPrincipal *aPrin)
245245{
246- uint32_t appId = aPrin->GetAppId ();
247-
248- // After bug 1238160, the principal no longer knows how to answer "is this a
249- // browser element", which is really what this code path wants. Currently,
250- // desktop is the only platform where we intend to disable isolation on a
251- // browser frame, so non-desktop should be able to assume that
252- // inIsolatedMozBrowser is true for all mozbrowser frames. Additionally,
253- // apps are no longer used on desktop, so appId is always NO_APP_ID. We use
254- // a release assertion in nsFrameLoader::OwnerIsIsolatedMozBrowserFrame so
255- // that platforms with apps can assume inIsolatedMozBrowser is true for all
256- // mozbrowser frames.
257- bool inIsolatedMozBrowser = aPrin->GetIsInIsolatedMozBrowserElement ();
258-
259- NS_WARNING_ASSERTION (
260- appId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
261- " Asking for app status on a principal with an unknown app id" );
262-
263- // Installed apps have a valid app id (not NO_APP_ID or UNKNOWN_APP_ID)
264- // and they are not inside a mozbrowser.
265- if (appId == nsIScriptSecurityManager::NO_APP_ID ||
266- appId == nsIScriptSecurityManager::UNKNOWN_APP_ID ||
267- inIsolatedMozBrowser)
268- {
269- return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
270- }
271-
272- nsCOMPtr<nsIAppsService> appsService = do_GetService (APPS_SERVICE_CONTRACTID);
273- NS_ENSURE_TRUE (appsService, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
274-
275- nsCOMPtr<mozIApplication> app;
276- appsService->GetAppByLocalId (appId, getter_AddRefs (app));
277- NS_ENSURE_TRUE (app, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
278-
279- uint16_t status = nsIPrincipal::APP_STATUS_INSTALLED;
280- NS_ENSURE_SUCCESS (app->GetAppStatus (&status),
281- nsIPrincipal::APP_STATUS_NOT_INSTALLED);
282-
283- nsString appOrigin;
284- NS_ENSURE_SUCCESS (app->GetOrigin (appOrigin),
285- nsIPrincipal::APP_STATUS_NOT_INSTALLED);
286- nsCOMPtr<nsIURI> appURI;
287- NS_ENSURE_SUCCESS (NS_NewURI(getter_AddRefs(appURI), appOrigin),
288- nsIPrincipal::APP_STATUS_NOT_INSTALLED);
289-
290- // The app could contain a cross-origin iframe - make sure that the content
291- // is actually same-origin with the app.
292- MOZ_ASSERT (inIsolatedMozBrowser == false , " Checked this above" );
293- nsAutoCString suffix;
294- PrincipalOriginAttributes attrs;
295- NS_ENSURE_TRUE (attrs.PopulateFromOrigin(NS_ConvertUTF16toUTF8(appOrigin), suffix),
296- nsIPrincipal::APP_STATUS_NOT_INSTALLED);
297- attrs.mAppId = appId;
298- attrs.mInIsolatedMozBrowser = false ;
299- nsCOMPtr<nsIPrincipal> appPrin = BasePrincipal::CreateCodebasePrincipal(appURI, attrs);
300- NS_ENSURE_TRUE (appPrin, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
301- return aPrin->Equals (appPrin) ? status
302- : nsIPrincipal::APP_STATUS_NOT_INSTALLED;
246+ return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
303247}
304248
305249/*
0 commit comments