FlexibleWrapper error when using wrapped constructors

RESOLVED WONTFIX

Status

Mozilla Labs
Jetpack Prototype
RESOLVED WONTFIX
9 years ago
8 years ago

People

(Reporter: adw, Unassigned)

Tracking

Details

Attachments

(2 attachments)

Created attachment 401237 [details] [diff] [review]
Simple test case

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.
Created attachment 401238 [details] [diff] [review]
test-secure-membrane.js patch
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
Last Resolved: 8 years ago
Resolution: --- → WONTFIX
(Reporter)

Updated

8 years ago
Attachment #401238 - Flags: review?(avarma)
You need to log in before you can comment on or make changes to this bug.