Bug 1041237 - The bitmask enums flags calculation for getBitToEnumValue is flawed, r=jsantell
authorVictor Porof <vporof@mozilla.com>
Tue, 22 Jul 2014 12:43:23 -0400
changeset 195534 7a250901c59db7f13b8b55d88c824b6c472a1f90
parent 195533 29d9c7cb0277490b5d1d9a8f1dd4211845fc133b
child 195535 af405d5651a15dd0663ba566b9827536c403971c
push id27185
push userkwierso@gmail.com
push dateWed, 23 Jul 2014 01:05:43 +0000
treeherdermozilla-central@5683746bac22 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsantell
bugs1041237
milestone34.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 1041237 - The bitmask enums flags calculation for getBitToEnumValue is flawed, r=jsantell
browser/devtools/canvasdebugger/test/browser_canvas-actor-test-09.js
browser/devtools/canvasdebugger/test/doc_webgl-enum.html
toolkit/devtools/server/actors/call-watcher.js
--- a/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-09.js
+++ b/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-09.js
@@ -21,11 +21,16 @@ function ifTestingSupported() {
   let animationOverview = yield snapshotActor.getOverview();
   let functionCalls = animationOverview.calls;
 
   is(functionCalls[0].name, "clear",
     "The function's name is correct.");
   is(functionCalls[0].argsPreview, "DEPTH_BUFFER_BIT | STENCIL_BUFFER_BIT | COLOR_BUFFER_BIT",
     "The bits passed into `gl.clear` have been cast to their enum values.");
 
+  is(functionCalls[1].name, "bindTexture",
+    "The function's name is correct.");
+  is(functionCalls[1].argsPreview, "TEXTURE_2D, null",
+    "The bits passed into `gl.bindTexture` have been cast to their enum values.");
+
   yield removeTab(target.tab);
   finish();
 }
--- a/browser/devtools/canvasdebugger/test/doc_webgl-enum.html
+++ b/browser/devtools/canvasdebugger/test/doc_webgl-enum.html
@@ -20,14 +20,15 @@
         canvas = document.querySelector("canvas");
         gl = canvas.getContext("webgl", { preserveDrawingBuffer: true });
         gl.clearColor(0.0, 0.0, 0.0, 1.0);
         drawScene();
       }
 
       function drawScene() {
         gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
+        gl.bindTexture(gl.TEXTURE_2D, null);
         window.requestAnimationFrame(drawScene);
       }
     </script>
   </body>
 
 </html>
--- a/toolkit/devtools/server/actors/call-watcher.js
+++ b/toolkit/devtools/server/actors/call-watcher.js
@@ -205,19 +205,22 @@ let FunctionCallActor = protocol.ActorCl
     let enumArgs = (CallWatcherFront.ENUM_METHODS[global] || {})[name];
     if (typeof enumArgs === "function") {
       enumArgs = enumArgs(args);
     }
 
     // XXX: All of this sucks. Make this smarter, so that the frontend
     // can inspect each argument, be it object or primitive. Bug 978960.
     let serializeArgs = () => args.map((arg, i) => {
-      if (typeof arg == "undefined") {
+      if (arg === undefined) {
         return "undefined";
       }
+      if (arg === null) {
+        return "null";
+      }
       if (typeof arg == "function") {
         return "Function";
       }
       if (typeof arg == "object") {
         return "Object";
       }
       // If this argument matches the method's signature
       // and is an enum, change it to its constant name.
@@ -638,17 +641,17 @@ CallWatcherFront.ENUM_METHODS[CallWatche
 
 /**
  * A lookup table for cross-referencing flags or properties with their name
  * assuming they look LIKE_THIS most of the time.
  *
  * For example, when gl.clear(gl.COLOR_BUFFER_BIT) is called, the actual passed
  * argument's value is 16384, which we want identified as "COLOR_BUFFER_BIT".
  */
-var gEnumRegex = /^[A-Z_]+$/;
+var gEnumRegex = /^[A-Z][A-Z0-9_]+$/;
 var gEnumsLookupTable = {};
 
 // These values are returned from errors, or empty values,
 // and need to be ignored when checking arguments due to the bitwise math.
 var INVALID_ENUMS = [
   "INVALID_ENUM", "NO_ERROR", "INVALID_VALUE", "OUT_OF_MEMORY", "NONE"
 ];