Closed Bug 517262 Opened 15 years ago Closed 14 years ago

FlexibleWrapper error when using wrapped constructors

Categories

(Mozilla Labs :: Jetpack Prototype, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: adw, Unassigned)

Details

Attachments

(2 files)

Attached patch Simple test caseSplinter Review
I expose a constructor to content features from my chrome lib, and when they use it they get a cryptic error involving FlexibleWrapper.

Attached is a test-case patch to jetpack-environment.js.  It exposes two constructors, F and G.  They are the same, except G calls a member function baz(), and when I try to create an instance of G from content, I get this error and stack:

  TypeError: this.baz is not a function

  G()@chrome://jetpack/content/js/jetpack-environment.js:329
  call(G,[object FlexibleWrapper],[object Object],[object Array])@chrome://jetpack/content/js/secure-membrane.js:285
  construct(G,[object FlexibleWrapper],[object Object],[object Array])@chrome://jetpack/content/js/secure-membrane.js:267
  @:0
  @file:///Users/adw/Library/Application%20Support/Firefox/Profiles/beb1kaoj.jetpack2/jetpack-editor-code.txt:29

G is like the constructor I expose in my chrome lib.  When I create an instance of F, I get undefined instead of an object.

If you run this code in Bespin, you can test the patch:

  // f is undefined.
  var f = new jetpack.foo.F();
  console.log(typeof(f));

  // Raises the error above.
  var g = new jetpack.foo.G();

Also attached is a patch to test-secure-membrane.js.  It simply wraps a trusted function and an untrusted function and makes sure when they're used as constructors they yield objects.
Attachment #401238 - Flags: review?(avarma)
We will be monitoring all these issues after the rebooted Jetpack code base is released in the first week of March to ensure their causes are not duplicated. Many of the bugs/issues with the prototype version of Jetpack will be made irrelevant given the structure of the new SDK.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
Attachment #401238 - Flags: review?(avarma)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: