Can not load jsm's function and objects.

Discuss building things with or for the Mozilla Platform.
Post Reply
gao.peng
Posts: 2
Joined: May 18th, 2014, 6:48 pm

Can not load jsm's function and objects.

Post by gao.peng »

Hi all,

Following is a block issue i met, i'll give out the detail about it.

I want to port Gaia from B2G to mobile Firefox, so that the mobile Firefox can run as a webapp manager on device.
So I modify configure.in file of Gecko and added B2G enable, and compiled a mobile version Firefox with B2G enabled.
Then I run this mobile version Firefox on device, and it can be loaded to about:blank page, but can not load any other pages, so Gaia webapp can not run on this mobile Firefox either.
Then I checked the rootcause, and found when loaded browser.xul, browser.js file run stoped since of meeting "[JavaScript Error: "TypeError: SpatialNavigation is undefined".
SpatialNavigation come from SpatialNavigation.jsm file, then I modify SpatialNavigation.jsm file found.
modify "var SpatialNavigation={ ..." to "this.SpatialNavigation={...", that works well.
but there are much more this kind of values were defined, I can not modify from one by one, and I want to know is that is there's some difference between G2G gecko loading jsm and Firefox gecko loading jsm?

Is there anyboy know about it and give some suggestion?

Many thanks.
User avatar
LIMPET235
Moderator
Posts: 39954
Joined: October 19th, 2007, 1:53 am
Location: The South Coast of N.S.W. Oz.

Re: Can not load jsm's function and objects.

Post by LIMPET235 »

Moving to Mozilla Dev...
[Ancient Amateur Astronomer.]
Win-10-H/64 bit/500G SSD/16 Gig Ram/450Watt PSU/350WattUPS/Firefox-115.0.2/T-bird-115.3.2./SnagIt-v10.0.1/MWP-7.12.125.

(Always choose the "Custom" Install.)
gao.peng
Posts: 2
Joined: May 18th, 2014, 6:48 pm

Re: Can not load jsm's function and objects.

Post by gao.peng »

I tried it acoording page: https://developer.mozilla.org/en-US/doc ... ils.import
added "this", modify from
Components.utils.import("resource://gre/modules/SpatialNavigation.jsm");
to
Components.utils.import("resource://gre/modules/SpatialNavigation.jsm", this);
but still can not fix it.

Anyone can give some suggestions?
Many thanks.
Post Reply