Closed Bug 978103 Opened 11 years ago Closed 7 years ago

We should deprecate requireApp()

Categories

(Firefox OS Graveyard :: Gaia::TestAgent, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: rik, Unassigned)

Details

As I learned by being backed out, TBPL doesn't like it when you try to include a file living in another app. Because that's the only purpose of requireApp(), we should deprecate it and then port all existing unit tests to use require().
Does that mean there are bugs in TestUrlResolver? requireApp simply uses require. Not sure what's the difference.
requireapp makes it easy to insert files from other apps. But other apps lives in different hostnames. And in B2G Desktop this breaks because of CSP. I'm not sure yet if it's normal that it breaks, or not, but it's just as easy to not do this. That means that requireApp is really useless and we should just use require, because, like you said, that's the same, except the different-app functionality. Hope this is clearer.
Hi Julien, Currently, the `require` method in our test-agnet could also insert files from other apps, right? I just did it, and it worked. In `apps/video/test/unit/video_utils_test.js` file, I just did `require('/apps/calendar/js/video_utils.js');`.
Are you sure? It should really not... '/' in these URLs is supposed to be the root of your application.
Julien, you could use this branch[1] to see the situation(Comment 3). The `apps/video/test/unit/video_utils_test.js` tests also works well after we require the `video_utils.js` file from the `calendar` folder[2]. Please check the branch. Do I misunderstand anything for that? [1] https://github.com/evanxd/gaia/tree/bug-978103 [2] /apps/calendar/js/video_utils.js
Flags: needinfo?(felash)
Actually, it seems to work like this now. What do you think Yuren, is it expected?
Flags: needinfo?(felash) → needinfo?(yurenju.mozilla)
yes, for example we want to access calendar/js/view.js: httpd server is started based on gaia directory[1], so you can access view.js by app://ANYDOMAIN.gaiamobile.org/apps/calendar/js/view.js, and we are also mapping files to subdomain per app[2], so you can access app://calendar.gaiamobile.org/js/view.js too. [1] https://github.com/mozilla-b2g/gaia/blob/88e0a972280bb35847c010b8c3f1481fa80f3847/tools/extensions/httpd/bootstrap.js#L509 [2] https://github.com/mozilla-b2g/gaia/blob/88e0a972280bb35847c010b8c3f1481fa80f3847/tools/extensions/httpd/content/httpd.js#L1533-L1552
Flags: needinfo?(yurenju.mozilla)
yeah, I knew that "app://calendar.gaiamobile.org/js/view.js" works (and doesn't work in B2G Desktop because of CSP), bt I didn't know about "app://ANYDOMAIN.gaiamobile.org/apps/calendar/js/view.js". If that's expected, fine to me. I think it's not particularly a good approach to do this though, but if that's not in my app, I don't care :)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.