Currently, Narcissus does not interact with the DOM. It needs to be updated so that it can be used within a browser.
Created attachment 461304 [details] [diff] [review] Narcissus browser support patch This patch replaces the global object with a proxy that will reach to the underlying JS engine when needed, allowing it to use browser-specific functions when available. This approach would allow the user to get at the underlying Narcissus constructs. I intend to file a separate bug for that. A number of new unit tests are passing. A few new ones are also failing, mostly due to the 'watch' construct.
Created attachment 462627 [details] [diff] [review] Updated patch to work with modularized Narcissus
Comment on attachment 462627 [details] [diff] [review] Updated patch to work with modularized Narcissus We could wrap the global object with a proxy. What do you think?
Comment on attachment 462627 [details] [diff] [review] Updated patch to work with modularized Narcissus >diff --git a/js/narcissus/browser.js b/js/narcissus/browser.js >new file mode 100644 >--- /dev/null >+++ b/js/narcissus/browser.js The makefile changes introduced in bug 583281 create symlinks for all files in narcissus/js*.js and the njs script depends on these. Is the Narcissus.browser module only enabled in the browser? Dave
Yup, the browser.js file is only needed for the browser.
Okay. Our file naming convention is a little goofy, but I guess it's not a big deal. Maybe just add a comment to js/src/shell/Makefile.in explaining that js*.js covers the shell-specific files and only the shell-specific files? Dave
Created attachment 463013 [details] [diff] [review] Replacement patch for including browser support Changes from previous patch: *Redesigned browser.js to rely less on specific names *Renamed browser.js to jsbrowser.js
Comment on attachment 463013 [details] [diff] [review] Replacement patch for including browser support Comment style: /* * */ We should ideally not patch the original window object.
Created attachment 464285 [details] [diff] [review] Update patch removes need for jsbrowser.js The new patch uses a proxy for native code functions. As part of this, the proxy setup has been refactored.
Comment on attachment 464285 [details] [diff] [review] Update patch removes need for jsbrowser.js Andreas approved with some changes: * changed 'realGlobal' to 'hostGlobal' * made notes of spidermonkey specific functionality