[Pkg-mozext-commits] [adblock-plus] 32/464: Another __proto__ format. Gee, these are common, aren't they?

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:43:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit 96484223909ab3888baef6a98baef3b621629f4e
Author: Joshua Cranmer <Pidgeot18 at gmail.com>
Date:   Mon May 11 15:28:21 2009 -0400

    Another __proto__ format. Gee, these are common, aren't they?
---
 utils/cleanast.js | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/utils/cleanast.js b/utils/cleanast.js
index 7c316b9..f1a5c32 100644
--- a/utils/cleanast.js
+++ b/utils/cleanast.js
@@ -191,12 +191,19 @@ function make_object(stub) {
         stub.setters[name] = make_function(value);
       else if (value.type == 34) // TOK_FUNCTION
         stub.functions[name] = make_function(value);
-      else if (name == '__proto__' && value.type == 49) { // TOK_NEW
+      else if (name == '__proto__') {
+        let supername;
+        if (value.op == JSOP_NEW)
+          supername = value.kids[0].atom;
+        else if (value.op == JSOP_GETPROP && value.atom == 'prototype')
+          supername = value.kids[0].atom;
+        else
+          assert(false);
         if ('inherits' in stub)
-      stub.inherits.push(value.kids[0].atom);
-    else
-      stub.inherits = [value.kids[0].atom];
-    }
+          stub.inherits.push(supoername);
+        else
+          stub.inherits = [supername];
+      }
       else
         stub.variables[name] = { loc: get_location(value), init: value };
     } else {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list