Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Bug 685564 - Make page-mod work on Firefox mobile #310

Merged
merged 13 commits into from
Dec 30, 2011

Conversation

ZER0
Copy link
Contributor

@ZER0 ZER0 commented Dec 22, 2011

const {Namespace: NS} = require("./namespace");

const scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZER0 sandbox manipulation low level API has landed to master recently, could you please use that instead of direct use of mozIJSSubScriptLoader and Cu.Sandbox ?

console.exception(e);
}
} else {
scriptLoader.loadSubScript(uri, sandbox);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to mention that sandbox API uses loadSubScript with third argument 'UTF-8', cause otherwise complex unicode chars are not handled properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed in IRC, I merged this code with load function of sandbox module.

@Gozala
Copy link
Contributor

Gozala commented Dec 22, 2011

It feels to me that MessageManager has a big overlap with EventEmitter in terms of listeners registration, dispatching events etc... It would be nice to reuse the same code. As a matter of fact I have a branch that implements event emitters using namespaces and Base that eventually should replace an old API. I think this change would have benefit from it.

@Gozala
Copy link
Contributor

Gozala commented Dec 22, 2011

I don't consider any of my comments to be critical or blocking this from landing, as they can be addressed in a follow up patch. In such case could you please fill a bug report for that and CC me there.

// `Namespace` is a e4x function in the scope, so we import the function as `NS`
// to avoid clashing, until we don't have a better candidate to replace
// `Namespace` in namespace module.
const {Namespace: NS} = require("./namespace");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: according to the convention it shoud be (spaces between curlyies) :

const { Namespace: NS } = require("./namespace");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used ns as an alias instead, and I think I saw Alex used something else. I'd suggest export ns from namespace module as an alias to Namespace and put the comment regarding e4x conflict there.

@mykmelez
Copy link
Contributor

@ZER0 asked me to look at the way tests are written, so I read through test-message-manager.js, and it looks great; I have no problem at all with the way the tests are written. r=@mykmelez on it!


let sandbox = Cu.Sandbox(systemPrincipal, { wantXrays : false });

Object.defineProperties(sandbox, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably use merge:

merge(sandbox, {
  addMessageListener: addMessageListener.bind(sandbox),
  ....
})

It will methods configurable & writable, but they are in normal massegaManager anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't have hard feeling about it, I'd like to keep the descriptors.

@ZER0
Copy link
Contributor Author

ZER0 commented Dec 30, 2011

@Gozala about the overlap with EventEmitter, as we discussed on IRC there are some slightly difference that makes not possible reuse the same code (e.g. I need to collect the responses for sync calls).

@mykmelez
Copy link
Contributor

@Gozala reviewed this pull request and gave it an r+, but @ZER0 made substantive enough changes that he wanted a followup review, so I did that today, as @Gozala is away; and from what I can tell, this patch is ready to land, so r=@mykmelez.

mykmelez added a commit that referenced this pull request Dec 30, 2011
fix Bug 685564 - Make page-mod work on Firefox mobile; r=@Gozala, @mykmelez
@mykmelez mykmelez merged commit 6eccac8 into mozilla:master Dec 30, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants