merge m-c into fx-team
authorGavin Sharp <gavin@gavinsharp.com>
Thu, 21 Jul 2011 21:06:19 -0400
changeset 73165 e7e32a922b12a33d22e9d681eb0ea70bb42faa41
parent 73164 0f11ca4d1733acc887a5a8f05e015a16ec6c35c6 (current diff)
parent 73159 7a1c228f8f85526f1bc80fd3c8dc8d4e81967ce4 (diff)
child 73166 19348341366bf1015021834c92bd18504daf2b5d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone8.0a1
merge m-c into fx-team
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -3319,51 +3319,16 @@ nsScriptSecurityManager::Observe(nsISupp
             PL_strcpy(lastDot + 1, id);
             const char** idPrefArray = (const char**)&message;
             rv = InitPrincipals(1, idPrefArray);
         }
     }
     return rv;
 }
 
-///////////////////////////////////
-// Default ObjectPrincipalFinder //
-///////////////////////////////////
-
-// The default JSSecurityCallbacks::findObjectPrincipals is necessary since
-// scripts run (and ask for object principals) during startup before
-// nsJSRuntime::Init() has been called (which resets findObjectPrincipals).
-
-// Defined NS_EXPORT for linkage with debug-only assert in xpcshell
-NS_EXPORT JSPrincipals *
-NS_DefaultObjectPrincipalFinder(JSContext *cx, JSObject *obj)
-{
-    nsScriptSecurityManager *ssm = nsScriptSecurityManager::GetScriptSecurityManager();
-    if (!ssm) {
-        return nsnull;
-    }
-
-    nsCOMPtr<nsIPrincipal> principal;
-    nsresult rv = ssm->GetObjectPrincipal(cx, obj, getter_AddRefs(principal));
-    if (NS_FAILED(rv) || !principal) {
-        return nsnull;
-    }
-
-    JSPrincipals *jsPrincipals = nsnull;
-    principal->GetJSPrincipals(cx, &jsPrincipals);
-
-    // nsIPrincipal::GetJSPrincipals() returns a strong reference to the
-    // JS principals, but the caller of this function expects a weak
-    // reference. So we need to release here.
-
-    JSPRINCIPALS_DROP(cx, jsPrincipals);
-
-    return jsPrincipals;
-}
-
 /////////////////////////////////////////////
 // Constructor, Destructor, Initialization //
 /////////////////////////////////////////////
 nsScriptSecurityManager::nsScriptSecurityManager(void)
     : mOriginToPolicyMap(nsnull),
       mDefaultPolicy(nsnull),
       mCapabilities(nsnull),
       mContextPrincipals(nsnull),
@@ -3426,17 +3391,17 @@ nsresult nsScriptSecurityManager::Init()
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = runtimeService->GetRuntime(&sRuntime);
     NS_ENSURE_SUCCESS(rv, rv);
 
     static JSSecurityCallbacks securityCallbacks = {
         CheckObjectAccess,
         NULL,
-        NS_DefaultObjectPrincipalFinder,
+        NULL,
         ContentSecurityPolicyPermitsJSAction
     };
 
 #ifdef DEBUG
     JSSecurityCallbacks *oldcallbacks =
 #endif
     JS_SetRuntimeSecurityCallbacks(sRuntime, &securityCallbacks);
     NS_ASSERTION(!oldcallbacks, "Someone else set security callbacks!");
--- a/content/base/src/contentSecurityPolicy.js
+++ b/content/base/src/contentSecurityPolicy.js
@@ -63,17 +63,16 @@ function ContentSecurityPolicy() {
   this._isInitialized = false;
   this._reportOnlyMode = false;
   this._policy = CSPRep.fromString("default-src *");
 
   // default options "wide open" since this policy will be intersected soon
   this._policy._allowInlineScripts = true;
   this._policy._allowEval = true;
 
-  this._requestHeaders = []; 
   this._request = "";
   this._docRequest = null;
   CSPdebug("CSP POLICY INITED TO 'default-src *'");
 }
 
 /*
  * Set up mappings from nsIContentPolicy content types to CSP directives.
  */
@@ -206,23 +205,16 @@ ContentSecurityPolicy.prototype = {
     // We will only be able to provide the HTTP version information if aChannel
     // implements nsIHttpChannelInternal
     if (internalChannel) {
       var reqMaj = {};
       var reqMin = {};
       var reqVersion = internalChannel.getRequestVersion(reqMaj, reqMin);
       this._request += " HTTP/" + reqMaj.value + "." + reqMin.value;
     }
-
-    // grab the request headers
-    var self = this;
-    aChannel.visitRequestHeaders({
-      visitHeader: function(aHeader, aValue) {
-        self._requestHeaders.push(aHeader + ": " + aValue);
-      }});
   },
 
 /* ........ Methods .............. */
 
   /**
    * Given a new policy, intersects the currently enforced policy with the new
    * one and stores the result.  The effect is a "tightening" or refinement of
    * an old policy.  This is called any time a new policy is encountered and
@@ -265,31 +257,23 @@ ContentSecurityPolicy.prototype = {
   function(blockedUri, violatedDirective, aSourceFile, aScriptSample, aLineNum) {
     var uriString = this._policy.getReportURIs();
     var uris = uriString.split(/\s+/);
     if (uris.length > 0) {
       // Generate report to send composed of
       // {
       //   csp-report: {
       //     request: "GET /index.html HTTP/1.1",
-      //     request-headers: "Host: example.com
-      //                       User-Agent: ...
-      //                       ...",
       //     blocked-uri: "...",
       //     violated-directive: "..."
       //   }
       // }
-      var strHeaders = "";
-      for (let i in this._requestHeaders) {
-        strHeaders += this._requestHeaders[i] + "\n";
-      }
       var report = {
         'csp-report': {
           'request': this._request,
-          'request-headers': strHeaders,
           'blocked-uri': (blockedUri instanceof Ci.nsIURI ?
                           blockedUri.asciiSpec : blockedUri),
           'violated-directive': violatedDirective
         }
       }
       // extra report fields for script errors (if available)
       if (aSourceFile)
         report["csp-report"]["source-file"] = aSourceFile;
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -1623,18 +1623,16 @@ nsFrameLoader::GetWindowDimensions(nsRec
     do_GetInterface(doc->GetScriptGlobalObject());
 
   if (!parentAsWebNav) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIDocShellTreeItem> parentAsItem(do_QueryInterface(parentAsWebNav));
 
-  NS_ASSERTION(mIsTopLevelContent, "Outer dimensions must be taken only from TopLevel content");
-
   nsCOMPtr<nsIDocShellTreeOwner> parentOwner;
   if (NS_FAILED(parentAsItem->GetTreeOwner(getter_AddRefs(parentOwner))) ||
       !parentOwner) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin(do_GetInterface(parentOwner));
   treeOwnerAsWin->GetPosition(&aRect.x, &aRect.y);
--- a/embedding/android/AndroidManifest.xml.in
+++ b/embedding/android/AndroidManifest.xml.in
@@ -1,15 +1,16 @@
 #filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="@ANDROID_PACKAGE_NAME@"
       android:installLocation="auto"
       android:versionCode="@ANDROID_VERSION_CODE@"
-      android:versionName="@MOZ_APP_VERSION@">
+      android:versionName="@MOZ_APP_VERSION@"
+      android:sharedUserId="@MOZ_ANDROID_SHARED_ID@">
     <uses-sdk android:minSdkVersion="5"
               android:targetSdkVersion="5"/>
 
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
--- a/embedding/android/Makefile.in
+++ b/embedding/android/Makefile.in
@@ -96,19 +96,27 @@ GARBAGE += \
   $(NULL)
 
 GARBAGE_DIRS += classes res
 
 # Bug 567884 - Need a way to find appropriate icons during packaging
 ifeq ($(MOZ_APP_NAME),fennec)
 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
+ifeq (org.mozilla.fennec_unofficial,$(ANDROID_PACKAGE_NAME))
+DEFINES += -DMOZ_ANDROID_SHARED_ID="org.mozilla.fennec_unofficial.sharedID"
+else ifeq (,$(MOZ_OFFICIAL_BRANDING))
+DEFINES += -DMOZ_ANDROID_SHARED_ID="org.mozilla.fennec.sharedID"
+else
+DEFINES += -DMOZ_ANDROID_SHARED_ID="org.mozilla.firefox.sharedID"
+endif
 else
 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
+DEFINES += -DMOZ_ANDROID_SHARED_ID="$(ANDROID_PACKAGE_NAME).sharedID"
 endif
 
 RES_LAYOUT = \
   res/layout/notification_progress.xml \
   res/layout/notification_progress_text.xml \
   res/layout/notification_icon_text.xml \
   res/layout/launch_app_list.xml \
   res/layout/launch_app_listitem.xml \
--- a/js/src/xpconnect/shell/xpcshell.cpp
+++ b/js/src/xpconnect/shell/xpcshell.cpp
@@ -1745,20 +1745,16 @@ GetCurrentWorkingDirectory(nsAString& wo
 }
 
 static JSPrincipals *
 FindObjectPrincipals(JSContext *cx, JSObject *obj)
 {
     return gJSPrincipals;
 }
 
-// defined in nsScriptSecurityManager.cpp
-NS_IMPORT JSPrincipals *
-NS_DefaultObjectPrincipalFinder(JSContext *cx, JSObject *obj);
-
 int
 main(int argc, char **argv, char **envp)
 {
 #ifdef XP_MACOSX
     InitAutoreleasePool();
 #endif
     JSRuntime *rt;
     JSContext *cx;
@@ -1902,17 +1898,17 @@ main(int argc, char **argv, char **envp)
                 }
             } else {
                 fprintf(gErrFile, "+++ Failed to get ScriptSecurityManager service, running without principals");
             }
         }
 
         JSSecurityCallbacks *cb = JS_GetRuntimeSecurityCallbacks(rt);
         NS_ASSERTION(cb, "We are assuming that nsScriptSecurityManager::Init() has been run");
-        NS_ASSERTION(cb->findObjectPrincipals == NS_DefaultObjectPrincipalFinder, "Your pigeon is in my hole!");
+        NS_ASSERTION(!cb->findObjectPrincipals, "Your pigeon is in my hole!");
         cb->findObjectPrincipals = FindObjectPrincipals;
 
 #ifdef TEST_TranslateThis
         nsCOMPtr<nsIXPCFunctionThisTranslator>
             translator(new nsXPCFunctionThisTranslator);
         xpc->SetFunctionThisTranslator(NS_GET_IID(nsITestXPCFunctionCallback), translator, nsnull);
 #endif
 
--- a/widget/src/cocoa/TextInputHandler.mm
+++ b/widget/src/cocoa/TextInputHandler.mm
@@ -179,17 +179,17 @@ GetCharacters(const NSString* aString)
   // the result will be freed automatically by cocoa.
   NSString* result = nsCocoaUtils::ToNSString(escapedStr);
   return [result UTF8String];
 }
 
 static const char*
 GetCharacters(const CFStringRef aString)
 {
-  NSString* str = reinterpret_cast<const NSString*>(aString);
+  const NSString* str = reinterpret_cast<const NSString*>(aString);
   return GetCharacters(str);
 }
 
 static const char*
 GetNativeKeyEventType(NSEvent* aNativeEvent)
 {
   switch ([aNativeEvent type]) {
     case NSKeyDown:      return "NSKeyDown";