Hi, everyone.  I've been tinkering around with Harmony's Proxy and WeakMap
implementations, and I've run into a problem.  A Jasmine test which works
fine in Mozilla Firefox Aurora builds throws an exception in Google Chrome
Dev builds, with the experimental JavaScript features enabled.

I really need some help in identifying whether the bug is in Aurora,
Chrome, or in my own code.  I wrote all of the JavaScript code in the
project, and to my knowledge none of it is browser- or engine-specific; it
should all conform to Harmony and ECMAScript standards unless I have a bug
in my code.

The concept I'm working on is using Proxy to create prototype objects for
constructor functions, and using a membrane like Tom van Cutsem's to
isolate private properties from public ones.

Steps to reproduce are below.  I have partially reduced my testcase so that
other parts of my project are not run as part of the test, and no Makefile
or other scripting commands are necessary.

Terminal commands:
hg clone --branch ProxyConstructorTest
http://code.google.com/p/dimensionalmap test-proto-membrane
cd test-proto-membrane/
hg update --rev 5992f4c09a38

Open V8-SpiderMonkey-test.html in Mozilla Firefox Aurora and in Google
Chrome Dev 19.

In FF Aurora, all tests pass.
In GC Dev:
TypeError: Object.getOwnPropertyDescriptor called on non-object
    at Function.getOwnPropertyDescriptor (native)
    at Object.getDesiredPropertyOwner
(file:///home/ajvincent/repositories/test-proto-membrane/ProtoMembrane/Membrane.js:59:34)
    at Object.foo
(file:///home/ajvincent/repositories/test-proto-membrane/ProtoMembrane/Membrane.js:82:31)
    at [object Object].<anonymous>
(file:///home/ajvincent/repositories/test-proto-membrane/spec/ProtoMembrane.js:94:21)

The function executing is in ProtoMembrane/Membrane.js:

  getDesiredPropertyOwner: function(originalThis, name) {
    var _thisObj = this.getPrivate(originalThis);
    if (_thisObj == originalThis) {
      while (_thisObj &&
!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(_thisObj), name)) {
        _thisObj = Object.getPrototypeOf(_thisObj);
      }
    }
    return _thisObj;
  },

In Aurora, _thisObj != originalThis, so it just moves on.
In GC Dev, _thisObj == originalThis, and on the second iteration of the
while loop, Object.getPrototypeOf(_thisObj) is null.
Object.getOwnPropertyDescriptor(null, "foo"); throws the TypeError.

-- 
"The first step in confirming there is a bug in someone else's work is
confirming there are no bugs in your own."
-- Alexander J. Vincent, June 30, 2001
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to