Closed Bug 1102504 Opened 10 years ago Closed 9 years ago

tabs-fennec.js ReferenceError: t is not defined

Categories

(Add-on SDK Graveyard :: General, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: anaran, Assigned: anaran)

References

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20141120030202

Steps to reproduce:

Debug with my jot add-on does not work in nightly fennec.


Actual results:

ReferenceError: t is not defined tabs-fennec.js:162:0

  for (let of in gTabs) {
    if (t === tab) continue; // line 162
    emit(t, 'deactivate', t);
    emit(gTabs, 'deactivate', t);
  }



Expected results:

Perhaps that code should be

  for (let t in gTabs) {
    if (t === tab) continue; // line 162
    emit(t, 'deactivate', t);
    emit(gTabs, 'deactivate', t);
  }
Attached file proposed fix for ReferenceError (obsolete) —
Commits pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/43970e6539150a384414a119b9d8147da74a3ea9
Bug 1102504 - tabs-fennec.js ReferenceError: t is not defined

https://github.com/mozilla/addon-sdk/commit/e0d7f425e52307aa0c9da2895ec6081509ffc3ad
Merge pull request #1727 from anaran/patch-1

Bug 1102504 - tabs-fennec.js ReferenceError: t is not defined r=erikvold
Assignee: nobody → adrian.aichner
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
it looks like this didn't get uplifted in time for aurora, but the original bug was.. :(

http://dxr.mozilla.org/mozilla-central/source/addon-sdk/source/lib/sdk/windows/tabs-fennec.js?from=tabs-fennec.js&case=true#161

Erik, what do you think, maybe we should request aurora uplift for this?
Status: RESOLVED → REOPENED
Flags: needinfo?(evold)
Resolution: FIXED → ---
(In reply to Tomislav Jovanovic [:zombie] from comment #4)

> Erik, what do you think, maybe we should request aurora uplift for this?

When is Aurora 36 uplift? +1 for asking for uplift if we are in fact too late.

Dev Edsition 36 release is *next* Friday, fyi.
(In reply to Tomislav Jovanovic [:zombie] from comment #4)
> it looks like this didn't get uplifted in time for aurora, but the original
> bug was.. :(
> 
> http://dxr.mozilla.org/mozilla-central/source/addon-sdk/source/lib/sdk/
> windows/tabs-fennec.js?from=tabs-fennec.js&case=true#161
> 
> Erik, what do you think, maybe we should request aurora uplift for this?

That question is above my paygrade.

Since most of our Fennec modules are broken now anyhow (which is primarily due to the fact that our Fennec test suite is not run on tinderbox) I don't see much point in spending my time trying to fix it..
Flags: needinfo?(evold)
(In reply to Erik Vold [:erikvold] (please needinfo? me) from comment #6)
> (In reply to Tomislav Jovanovic [:zombie] from comment #4)
> > it looks like this didn't get uplifted in time for aurora, but the original
> > bug was.. :(
> > 
> > http://dxr.mozilla.org/mozilla-central/source/addon-sdk/source/lib/sdk/
> > windows/tabs-fennec.js?from=tabs-fennec.js&case=true#161
> > 
> > Erik, what do you think, maybe we should request aurora uplift for this?
> 
> That question is above my paygrade.
> 
> Since most of our Fennec modules are broken now anyhow (which is primarily
> due to the fact that our Fennec test suite is not run on tinderbox) I don't
> see much point in spending my time trying to fix it..

Yes, I tried to press my point in #jetpack recently that without a convenient (or any at all really) way to test addon-sdk changes in fennec add-ons for that platform will just always be broken.

This bug is just one example.

And my fix is actually broken too!

I just I had tested it properly, but apparently not.

Only today when I built with 
cfx xpi -v --force-mobile -b c:/programme/nightly/firefox.exe" --no-strip-xpi --force-use-bundled-sdk
was I able to test that sdk code.

jpm needs the equivalent of
cfx xpi ...  --no-strip-xpi --force-use-bundled-sdk
to get that testing done early.

I guess this might not always work with the firefox platform under test.

I hope the as of yet unassigned
Bug 971098 - Support overrides for toolkit/loader
will address this in a better way.

So, given all this I am not sure how much time :margaret and I should spend on
Bug 1106415 - Allow the add-on SDK to dynamically insert add-on options

Adrian
Commits pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/080b7be7ddd9a7bfcb74b09700ba37e3581daf4b
Bug 1102504 - tabs-fennec.js ReferenceError: t is not defined

https://github.com/mozilla/addon-sdk/commit/3eee20bae2d901c8de896a7d0aceefe1cf1ead8a
Merge pull request #1739 from anaran/patch-1

Bug 1102504 - tabs-fennec.js ReferenceError: t is not defined r=erikvold
Attachment #8531325 - Flags: review?(erikvvold) → review+
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
nightly fennec is still/again broken:

  for (let of in gTabs) {
    if (t === tab) continue;
    emit(t, 'deactivate', t);
    emit(gTabs, 'deactivate', t);
  }

lastet addon-sdk sources don't have the for loop anymore.

so either there is a new uplift necessary or pull #1739 needs to be applied again.

I would really like to switch to jpm, but this is a stopper bug.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to adrian.aichner from comment #10)
> nightly fennec is still/again broken:
> 
>   for (let of in gTabs) {
>     if (t === tab) continue;
>     emit(t, 'deactivate', t);
>     emit(gTabs, 'deactivate', t);
>   }
> 
> lastet addon-sdk sources don't have the for loop anymore.
> 
> so either there is a new uplift necessary or pull #1739 needs to be applied
> again.

I'm guess you merely see that the uplift hasn't occurred yet, which is bug 1114752, and this has some blockers atm.

> I would really like to switch to jpm, but this is a stopper bug.

This is an issue with cfx and jpm, because it's really an sdk bug..
in cfx i can at least bundle the sdk sources with an add-on to keep it alive through all this.
Looks like that broken code even made it into Firefox 34.0 for Android.

I upgraded to firefox 36.0 for android.

it seems to have minified sources but also has
  for (let of in gTabs) {
    if (t === tab) continue;
    emit(t, 'deactivate', t);
    emit(gTabs, 'deactivate', t);
  }
This one is now resolved in nightly fennec.
It is still present in Firefox Beta for Android.

My Jot add-on still does not run in fennec nightly, now with this new error signature:

TypeError: can't access dead object
Stack trace:
getInnerId@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/window/utils.js:78:3
initialize/model.observe@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/content/worker.js:62:27
Observer<.observe@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/system/events.js:72:7
 events.js:79
TypeError: can't access dead object

I realize this is not much to go by, but perhaps this is already a known issue.

Let me know if you need more info.
Blocks: 1130602
Priority: -- → P1
This is still broken in Firefox Android 37.0.2, downloaded from the Play store yesterday.

I have two addons I am developing which worked perfectly in Firefox Android 32.x but which now fail to run the Javascript on the tab they open.

The following is output as part of the cfx log:

JavaScript error: resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///storage/sdcard0/jetpack-profile/extensions/jid1-92RK0GRAAyd1eQ@jetpack.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/windows/tabs-fennec.js, line 18: ReferenceError: t is not defined
W/GeckoConsole(23110): [JavaScript Error: "ReferenceError: t is not defined" {file: "resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///storage/sdcard0/jetpack-profile/extensions/jid1-92RK0GRAAyd1eQ@jetpack.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/windows/tabs-fennec.js" line: 18}]

This would appear to be a pretty basic breakage. I've read the earlier comments about the problems with testing and wonder if developing addons for Firefox Android is something which is no longer supported.

Are there any suggested workarounds ?

I noticed you can checkout the SDK from GitHub but the installation comments say it can only be used with Firefox Nightly.
(In reply to Simon Clubley from comment #15)
> This is still broken in Firefox Android 37.0.2, downloaded from the Play
> store yesterday.
> 
> I have two addons I am developing which worked perfectly in Firefox Android
> 32.x but which now fail to run the Javascript on the tab they open.
> 
> The following is output as part of the cfx log:
> 
> JavaScript error: resource://gre/modules/addons/XPIProvider.jsm ->
> jar:file:///storage/sdcard0/jetpack-profile/extensions/jid1-
> 92RK0GRAAyd1eQ@jetpack.xpi!/bootstrap.js ->
> resource://gre/modules/commonjs/toolkit/loader.js ->
> resource://gre/modules/commonjs/sdk/windows/tabs-fennec.js, line 18:
> ReferenceError: t is not defined
> W/GeckoConsole(23110): [JavaScript Error: "ReferenceError: t is not defined"
> {file: "resource://gre/modules/addons/XPIProvider.jsm ->
> jar:file:///storage/sdcard0/jetpack-profile/extensions/jid1-
> 92RK0GRAAyd1eQ@jetpack.xpi!/bootstrap.js ->
> resource://gre/modules/commonjs/toolkit/loader.js ->
> resource://gre/modules/commonjs/sdk/windows/tabs-fennec.js" line: 18}]
> 
> This would appear to be a pretty basic breakage. I've read the earlier
> comments about the problems with testing and wonder if developing addons for
> Firefox Android is something which is no longer supported.
> 
> Are there any suggested workarounds ?
> 
> I noticed you can checkout the SDK from GitHub but the installation comments
> say it can only be used with Firefox Nightly.

Can you provide a link to where it says that?

This bug is a nasty one, as it crept into multiple Firefox releases.

Things are starting to look good for jpm-built add-ons for android as well in nightly, aside from the lack of inline option support on android.
(In reply to adrian.aichner from comment #16)
> (In reply to Simon Clubley from comment #15)
> > 
> > I noticed you can checkout the SDK from GitHub but the installation comments
> > say it can only be used with Firefox Nightly.
> 
> Can you provide a link to where it says that?
> 

https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Installation#Using_the_SDK_from_Git

Having taken a second look at the wording on that page, I see it's a little unclear and now I've taken a closer look, I see there are multiple GitHub branches for various Firefox versions. I suspect fixing up the error in the Firefox 36 branch will allow me to use that branch just fine with Firefox 37.x.

> This bug is a nasty one, as it crept into multiple Firefox releases.
> 

Indeed. I would welcome suggestions about how I can work around it if I am wrong about the above.
I've had another look at this and I am still trying to work around this bug without success.

What is the recommended way to integrate an external SDK (as downloaded from GitHub) with your addon ?

This is the command I am currently using:

cfx run -v -a fennec-on-device -b /android-sdk/platform-tools/adb --mobile-app firefox --force-mobile --no-strip-xpi --overload-modules

As mentioned, I am using Firefox 37.0.2. I have downloaded the Firefox 36 and Firefox 38 branches from GitHub and tried both of them; I modified the Firefox 36 tabs-fennec.js with the changes from the Firefox 38 branch.

In both cases, the main addon main.js code runs, but content scripts attached with tab.attach simply don't appear to be running (I placed a console.log() in the content script to check this analysis).

Suggestions about working around this bug are welcome.

Thanks.
I think the fix has made it into current release of fennec so this bug can be closed now.

Please report back if you still see this in fennec and report version number you are using.
Status: REOPENED → RESOLVED
Closed: 10 years ago9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: