If the callbacks are called before they are registered, Fire IE will crash (unhandled std::bad_function_call exception).
Original code is not compliant with ECMAScript Strict Mode.
This commit implements the scriptable part of the interface. Non-scriptable part needs native code which is not possible in pure JS.
Ensure compatibility with Firefox 36+
This commit potentially fixes the root cause of commit bf84687. LOAD_FLAGS_REPLACE_HISTORY somehow doesn't update the page's owner domain (in this case, about:blank), thus history.replaceState in container page will fail. This flag isn't needed anyway, since the initial new tab URL is about:blank, which will never be recorded in session history.
sendSyncMessage returns an array of return values. Didn't expect that.