Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24404] Titanium projects specify "global.global != global" different

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-12-14T19:46:02.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.1.0
ComponentsAndroid
Labelsn/a
ReporterJay Phelps
AssigneeJan Vennemann
Created2017-02-15T00:05:26.000+0000
Updated2018-03-14T18:16:26.000+0000

Description

One of the users of the [RxJS](https://github.com/ReactiveX/rxjs) library reported that Appcelarator doesn't define global.global = global like node.js does. Since node.js doesn't have an official spec, I can't link to this behavior (it's also not documented best I can tell) but it was almost certainly borrowed from the fact that in browsers window.window = window--[that's spec'd here](https://html.spec.whatwg.org/multipage/browsers.html#the-window-object). Since appcelerator says it has [full node.js support](http://docs.appcelerator.com/platform/latest/#!/guide/Node.js_Support) minus some documented caveats, we were wondering if it would be easy and acceptable to also have global.global = global? Note that RxJS not the only library using global.global == global checks. There are [many](https://www.npmjs.com/package/window-or-global). It's mostly done to confirm we're not accidentally using a variable that happens to be named global but isn't really what we're looking for. Separately, we're going to discuss whether we could relax this check--but I think appcelerator would benefit from defining it regardless, cause others rely on it. RxJS issue: https://github.com/ReactiveX/rxjs/issues/2366

Comments

  1. Jan Vennemann 2017-10-25

    PR: https://github.com/appcelerator/titanium_mobile/pull/9552
  2. Christopher Williams 2017-11-21

    Folded this into my PR here: https://github.com/appcelerator/titanium_mobile/pull/9512 This PR cherry-picks Jan's iOS implementation and adds the Android implementation and a test for it. I've contacted [~kiguchi] on Teams to see if he can do the same for Windows.
  3. Christopher Williams 2017-12-14

    I merged the iOS half of this. There's a couple commits in my PR to do the same for Android. I'll see if I can cherry-pick and merge those without having to wait for the transpile PR.
  4. Christopher Williams 2017-12-14

    cherry-picked to it's own PR for android: https://github.com/appcelerator/titanium_mobile/pull/9689
  5. Christopher Williams 2017-12-14

    Merged android PR as well. Windows was already good on this one.
  6. Lokesh Choudhary 2018-03-14

    Verified the fix in SDK 7.1.0.v20180308150545 & 7.2.0.v20180313125304. Closing. Studio Ver: 5.0.0.201712081732 OS Ver: 10.13.2 Xcode Ver: Xcode 9.2 Appc NPM: 4.2.12 Appc CLI: 7.0.2 Daemon Ver: 1.0.1 Ti CLI Ver: 5.0.14 Alloy Ver: 1.11.0 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 — Android 6.0.1 ⇨ google Nexus 6P — Android 8.0.0

JSON Source