merge m-c to fx-team
authorTim Taubert <tim.taubert@gmx.de>
Sun, 01 Jan 2012 16:51:47 +0100
changeset 83627 d702c3cf4e4acfb68df904a3ed69dad9e287cf42
parent 83623 d77b056ed4bdefed6a29ae722b014c8b4b066d95 (current diff)
parent 83626 5fdc72d7ac9115630e1fd329b3b9d5563d80366b (diff)
child 83628 51965075faf527b132104dfcb62f313baecbcc34
push id21775
push usertim.taubert@gmx.de
push dateSun, 01 Jan 2012 15:54:28 +0000
treeherdermozilla-central@d702c3cf4e4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone12.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
merge m-c to fx-team
--- a/toolkit/content/widgets/videocontrols.css
+++ b/toolkit/content/widgets/videocontrols.css
@@ -15,16 +15,17 @@
 .scrubber .scale-slider,
 .volumeControl .scale-slider {
   -moz-user-focus: none;
 }
 
 .mediaControlsFrame {
   direction: ltr;
   /* Prevent unwanted style inheritance. See bug 554717. */
+  text-align: left;
   list-style-image: none !important;
   font: normal normal normal 100%/normal sans-serif !important;
   text-decoration: none !important;
 }
 
 /* CSS Transitions
  *
  * These are overriden by the default theme; the rules here just 
--- a/toolkit/mozapps/extensions/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/AddonRepository.jsm
@@ -1252,18 +1252,20 @@ var AddonRepository = {
         callback(null);
       }
     });
   },
 
   // Parses addon_compatibility nodes, that describe compatibility overrides.
   _parseAddonCompatElement: function(aResultObj, aElement) {
     let guid = this._getDescendantTextContent(aElement, "guid");
-    if (!guid)
+    if (!guid) {
+        LOG("Compatibility override is missing guid.");
       return;
+    }
 
     let compat = {id: guid};
     compat.hosted = aElement.getAttribute("hosted") != "false";
 
     function findMatchingAppRange(aNodes) {
       let toolkitAppRange = null;
       for (let i = 0; i < aNodes.length; i++) {
         let node = aNodes[i];
@@ -1287,31 +1289,41 @@ var AddonRepository = {
           return appRange;
       }
       return toolkitAppRange;
     }
 
     function parseRangeNode(aNode) {
       let type = aNode.getAttribute("type");
       // Only "incompatible" (blacklisting) is supported for now.
-      if (type != "incompatible")
+      if (type != "incompatible") {
+        LOG("Compatibility override of unsupported type found.");
         return null;
+      }
 
       let override = new AddonManagerPrivate.AddonCompatibilityOverride(type);
 
       override.minVersion = this._getDirectDescendantTextContent(aNode, "min_version");
       override.maxVersion = this._getDirectDescendantTextContent(aNode, "max_version");
 
-      if (!override.minVersion || !override.maxVersion)
+      if (!override.minVersion) {
+        LOG("Compatibility override is missing min_version.");
         return null;
+      }
+      if (!override.maxVersion) {
+        LOG("Compatibility override is missing max_version.");
+        return null;
+      }
 
       let appRanges = aNode.querySelectorAll("compatible_applications > application");
       let appRange = findMatchingAppRange.bind(this)(appRanges);
-      if (!appRange)
+      if (!appRange) {
+        LOG("Compatibility override is missing a valid application range.");
         return null;
+      }
 
       override.appID = appRange.appID;
       override.appMinVersion = appRange.appMinVersion;
       override.appMaxVersion = appRange.appMaxVersion;
 
       return override;
     }
 
--- a/toolkit/mozapps/extensions/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/XPIProvider.jsm
@@ -6143,27 +6143,29 @@ AddonInstall.prototype = {
    */
   loadManifest: function AI_loadManifest(aCallback) {
     function addRepositoryData(aAddon) {
       // Try to load from the existing cache first
       AddonRepository.getCachedAddonByID(aAddon.id, function(aRepoAddon) {
         if (aRepoAddon) {
           aAddon._repositoryAddon = aRepoAddon;
           aAddon.compatibilityOverrides = aRepoAddon.compatibilityOverrides;
+          aAddon.appDisabled = !isUsableAddon(aAddon);
           aCallback();
           return;
         }
 
         // It wasn't there so try to re-download it
         AddonRepository.cacheAddons([aAddon.id], function() {
           AddonRepository.getCachedAddonByID(aAddon.id, function(aRepoAddon) {
             aAddon._repositoryAddon = aRepoAddon;
             aAddon.compatibilityOverrides = aRepoAddon ?
                                               aRepoAddon.compatibilityOverrides :
                                               null;
+            aAddon.appDisabled = !isUsableAddon(aAddon);
             aCallback();
           });
         });
       });
     }
 
     let zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].
                     createInstance(Ci.nsIZipReader);
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/addons/test_install6/install.rdf
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<!-- An extension that has a compatibility override making it incompatible. -->
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+  <Description about="urn:mozilla:install-manifest">
+    <em:id>addon6@tests.mozilla.org</em:id>
+    <em:version>1.0</em:version>
+
+    <!-- Front End MetaData -->
+    <em:name>Addon Test 6</em:name>
+    <em:description>Test Description</em:description>
+
+    <em:targetApplication>
+      <Description>
+        <em:id>xpcshell@tests.mozilla.org</em:id>
+        <em:minVersion>1</em:minVersion>
+        <em:maxVersion>1</em:maxVersion>
+      </Description>
+    </em:targetApplication>
+
+  </Description>
+</RDF>
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_install.xml
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_install.xml
@@ -26,9 +26,28 @@
         <appID>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</appID>
         <min_version>0</min_version>
         <max_version>*</max_version>
       </application>
     </compatible_applications>
     <compatible_os>ALL</compatible_os>
     <install size="2">http://example.com/browser/toolkit/mozapps/extensions/test/browser/addons/browser_install1_2.xpi</install>
   </addon>
+
+  <addon_compatibility hosted="false">
+    <guid>addon6@tests.mozilla.org</guid>
+    <name>Addon Test 6</name>
+    <version_ranges>
+      <version_range type="incompatible">
+        <min_version>1.0</min_version>
+        <max_version>1.0</max_version>
+        <compatible_applications>
+          <application>
+            <name>XPCShell</name>
+            <min_version>1.0</min_version>
+            <max_version>1.0</max_version>
+            <appID>xpcshell@tests.mozilla.org</appID>
+          </application>
+        </compatible_applications>
+      </version_range>
+    </version_ranges>
+  </addon_compatibility>
 </searchresults>
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install.js
@@ -1673,12 +1673,57 @@ function check_test_28(install) {
     "onInstallCancelled"
   ], finish_test_28);
   return false;
 }
 
 function finish_test_28(install) {
   prepare_test({}, [
     "onDownloadCancelled"
-  ], do_test_finished);
+  ], run_test_29);
 
   install.cancel();
 }
+
+// Tests that an install with a matching compatibility override has appDisabled
+// set correctly.
+function run_test_29() {
+  Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
+
+  prepare_test({ }, [
+    "onNewInstall"
+  ]);
+
+  let url = "http://localhost:4444/addons/test_install6.xpi";
+  AddonManager.getInstallForURL(url, function(install) {
+    ensure_test_completed();
+
+    do_check_neq(install, null);
+    do_check_eq(install.version, "1.0");
+    do_check_eq(install.name, "Addon Test 6");
+    do_check_eq(install.state, AddonManager.STATE_AVAILABLE);
+
+    AddonManager.getInstallsByTypes(null, function(activeInstalls) {
+      do_check_eq(activeInstalls.length, 1);
+      do_check_eq(activeInstalls[0], install);
+
+      prepare_test({}, [
+        "onDownloadStarted",
+        "onDownloadEnded"
+      ], check_test_29);
+      install.install();
+    });
+  }, "application/x-xpinstall", null, "Addon Test 6", null, "1.0");
+}
+
+function check_test_29(install) {
+  //ensure_test_completed();
+  do_check_eq(install.state, AddonManager.STATE_DOWNLOADED);
+  do_check_neq(install.addon, null);
+  do_check_false(install.addon.isCompatible);
+  do_check_true(install.addon.appDisabled);
+
+  prepare_test({}, [
+    "onDownloadCancelled"
+  ], do_test_finished);
+  install.cancel();
+  return false;
+}