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

Commit

Permalink
Bug 679198: stop using .wrappedJSObject where it isn't necessary. r=i…
Browse files Browse the repository at this point in the history
…rakli
  • Loading branch information
ochameau committed Aug 16, 2011
1 parent fb55328 commit 7610f75
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/addon-kit/lib/context-menu.js
Expand Up @@ -758,7 +758,7 @@ WorkerRegistry.prototype = {

_makeWorker: function WR__makeWorker(win) {
let worker = ContextMenuWorker({
window: win.wrappedJSObject,
window: win,
contentScript: this.item.contentScript,
contentScriptFile: this.item.contentScriptFile,
onError: function (err) console.exception(err)
Expand Down
2 changes: 1 addition & 1 deletion packages/addon-kit/lib/page-mod.js
Expand Up @@ -162,7 +162,7 @@ const PageMod = Loader.compose(EventEmitter, {
},
_createWorker: function _createWorker(window) {
let worker = Worker({
window: window.wrappedJSObject,
window: window,
contentScript: this.contentScript,
contentScriptFile: this.contentScriptFile,
onError: this._onUncaughtError
Expand Down
5 changes: 5 additions & 0 deletions packages/api-utils/lib/content/content-proxy.js
Expand Up @@ -774,7 +774,12 @@ function handlerMaker(obj) {
* Wrap an object from the document to a proxy wrapper.
*/
exports.create = function create(object) {
// We accept either a XrayWrapper or an unwrapped reference
if ("wrappedJSObject" in object)
object = object.wrappedJSObject;

let xpcWrapper = XPCNativeWrapper(object);

// If we can't build an XPCNativeWrapper, it doesn't make sense to build
// a proxy. All proxy code is based on having such wrapper that store
// different JS attributes set.
Expand Down
2 changes: 1 addition & 1 deletion packages/api-utils/lib/content/symbiont.js
Expand Up @@ -194,7 +194,7 @@ const Symbiont = Worker.resolve({
* content scripts according to contentScriptWhen. Overloaded by Panel.
*/
_onInit: function () {
this._initWorker({ window: this._frame.contentWindow.wrappedJSObject });
this._initWorker({ window: this._frame.contentWindow });
}

});
Expand Down
2 changes: 1 addition & 1 deletion packages/api-utils/lib/content/worker.js
Expand Up @@ -228,7 +228,7 @@ const WorkerGlobalScope = AsyncEventEmitter.compose({
// JavaScript values.
// NOTE: this functionality is experimental and may change or go away
// at any time!
unsafeWindow: { get: function () window }
unsafeWindow: { get: function () window.wrappedJSObject }
});

// Overriding / Injecting some natives into sandbox.
Expand Down
4 changes: 2 additions & 2 deletions packages/api-utils/lib/tabs/tab.js
Expand Up @@ -189,7 +189,7 @@ const TabTrait = Trait.compose(EventEmitter, {
*/
attach: function attach(options) {
let { Worker } = require("../content/worker");
options.window = this._contentWindow.wrappedJSObject;
options.window = this._contentWindow;
let worker = Worker(options);
worker.once("detach", function detach() {
worker.destroy();
Expand Down Expand Up @@ -250,7 +250,7 @@ exports.Options = Options;

exports.getTabForWindow = function (win) {
// Get browser window
let topWindow = XPCNativeWrapper(win).QueryInterface(Ci.nsIInterfaceRequestor)
let topWindow = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
Expand Down

0 comments on commit 7610f75

Please sign in to comment.