SecureMembrane.BaseWrapper.iteratorObject is broken

RESOLVED FIXED in 0.6

Status

P1
normal
RESOLVED FIXED
9 years ago
8 years ago

People

(Reporter: adw, Assigned: adw)

Tracking

Details

Attachments

(1 attachment)

(Assignee)

Description

9 years ago
None of the Twitter lib functions work in the 0.5 release and current trunk.  Here's the error and stack (from code in the Bespin panel) they all produce:

TypeError: this.safeGetProperty is not a function

keyValueIterator()@chrome://jetpack/content/js/secure-membrane.js:144
userOptsToAjaxOpts([object FlexibleWrapper])@chrome://jetpack/content/js/twitter.js:343
([object FlexibleWrapper])@chrome://jetpack/content/js/twitter.js:313
call((function (opts) {try {var ajaxOpts = userOptsToAjaxOpts(opts);var url = [aSchemeAndHost].concat(urlFrags).concat(interpParam ? ajaxOpts.data[interpParam] : []).join("/") + ".json";ajax(url, aHttpMethod, ajaxOpts);} catch (err) {dump("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + err + "\n" + err.stack + "\n");}}),[object FlexibleWrapper],[object FlexibleWrapper],[object Array])@chrome://jetpack/content/js/secure-membrane.js:285
@:0
@file:///Users/adw/Library/Application%20Support/Firefox/Profiles/beb1kaoj.jetpack2/jetpack-editor-code.txt:3

All Twitter lib functions go through userOptsToAjaxOpts(), which takes an object passed in by the feature, aUserOpts, and iterates over its keys and values:

    for (let [prop, val] in Iterator(aUserOpts))
      dupe[prop] = val;

Line 343 as indicated by the stack is the second line above.  dupe is an object local to userOptsToAjaxOpts().

Atul, what exactly is the problem here?  Is line 343 erroneous?  Is it actually Iterator(aUserOpts) that's causing the error in keyValueIterator()?
(Assignee)

Comment 1

9 years ago
SecureMembrane.BaseWrapper.iteratorObject is broken due to a typo, |this| -> |self| in the inner keyValueIterator function.  |this| evaluates to the global object, not the object being iterated over.  |self| is defined but never used.
Summary: Twitter library is broken → SecureMembrane.BaseWrapper.iteratorObject is broken
(Assignee)

Comment 2

9 years ago
Created attachment 401688 [details] [diff] [review]
patch + test

Atul, can you review this so we can land it ASAP?  This bug breaks Twitter and my menu code.  Really annoying.
Attachment #401688 - Flags: review?(avarma)

Comment 3

9 years ago
Thanks Drew!  Committed here:

  http://hg.mozilla.org/labs/jetpack/rev/770d7cdb7c92
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
(Assignee)

Updated

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