Bug 1065998 - Empty-check Windows8WindowFrameColor's customizationColor in case its registry value is gone. r=jaws, a=sledru
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 18 Sep 2014 13:58:07 +0200
changeset 216852 12a5b8d685b2
parent 216851 e178848e43d1
child 216853 a4697303afa6
push id3942
push userryanvm@gmail.com
push date2014-09-26 13:41 +0000
treeherdermozilla-beta@2b061899d368 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, sledru
bugs1065998
milestone33.0
Bug 1065998 - Empty-check Windows8WindowFrameColor's customizationColor in case its registry value is gone. r=jaws, a=sledru
browser/modules/Windows8WindowFrameColor.jsm
--- a/browser/modules/Windows8WindowFrameColor.jsm
+++ b/browser/modules/Windows8WindowFrameColor.jsm
@@ -17,24 +17,28 @@ const Windows8WindowFrameColor = {
   get: function() {
     if (this._windowFrameColor)
       return this._windowFrameColor;
 
     const HKCU = Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER;
     const dwmKey = "Software\\Microsoft\\Windows\\DWM";
     let customizationColor = Registry.readRegKey(HKCU, dwmKey,
                                                  "ColorizationColor");
+    if (!customizationColor) {
+      // Seems to be the default color (hardcoded because of bug 1065998)
+      return [158, 158, 158];
+    }
     // The color returned from the Registry is in decimal form.
     let customizationColorHex = customizationColor.toString(16);
     // Zero-pad the number just to make sure that it is 8 digits.
     customizationColorHex = ("00000000" + customizationColorHex).substr(-8);
     let customizationColorArray = customizationColorHex.match(/../g);
     let [unused, fgR, fgG, fgB] = customizationColorArray.map(function(val) parseInt(val, 16));
     let colorizationColorBalance = Registry.readRegKey(HKCU, dwmKey,
-                                                       "ColorizationColorBalance");
+                                                       "ColorizationColorBalance") || 78;
      // Window frame base color when Color Intensity is at 0, see bug 1004576.
     let frameBaseColor = 217;
     let alpha = colorizationColorBalance / 100;
 
     // Alpha-blend the foreground color with the frame base color.
     let r = Math.round(fgR * alpha + frameBaseColor * (1 - alpha));
     let g = Math.round(fgG * alpha + frameBaseColor * (1 - alpha));
     let b = Math.round(fgB * alpha + frameBaseColor * (1 - alpha));