Backout bug 1072980 due to regressions (a=backout)

This commit is contained in:
Bill McCloskey 2014-12-20 21:15:36 -08:00
parent 41b26b97c1
commit f9e9be69df
6 changed files with 21 additions and 65 deletions

View File

@ -42,9 +42,9 @@ function checkState(tab) {
// deserialized in the content scope. And in this case, since RegExps are
// not currently Xrayable (see bug 1014991), trying to pull |obj3| (a RegExp)
// off of an Xrayed Object won't work. So we need to waive.
runInContent(tab.linkedBrowser, function(win, state) {
return Cu.waiveXrays(state).obj3.toString();
}, aEvent.state).then(function(stateStr) {
runInContent(tab.linkedBrowser, function(win, event) {
return Cu.waiveXrays(event.state).obj3.toString();
}, aEvent).then(function(stateStr) {
is(stateStr, '/^a$/', "second popstate object.");
// Make sure that the new-elem node is present in the document. If it's

View File

@ -197,24 +197,6 @@
let savedElement = null;
function recvDomTest(message) {
savedElement = message.objects.element;
// Test to ensure that we don't pass CPOWs to C++-implemented interfaces.
// See bug 1072980.
if (test_state == "remote") {
let walker = Components.classes["@mozilla.org/inspector/deep-tree-walker;1"]
.createInstance(Components.interfaces.inIDeepTreeWalker);
const SHOW_ELEMENT = Components.interfaces.nsIDOMNodeFilter.SHOW_ELEMENT;
walker.showAnonymousContent = true;
walker.showSubDocuments = false;
try {
walker.init(savedElement, SHOW_ELEMENT);
ok(false, "expected exception passing CPOW to C++");
} catch (e) {
is(e.result, Components.results.NS_ERROR_XPC_CANT_PASS_CPOW_TO_NATIVE,
"got exception when passing CPOW to C++");
}
}
}
function recvDomTestAfterGC(message) {

View File

@ -10,7 +10,6 @@
#include "nsWrapperCacheInlines.h"
#include "XPCLog.h"
#include "jsprf.h"
#include "JavaScriptParent.h"
#include "AccessCheck.h"
#include "WrapperFactory.h"
#include "XrayWrapper.h"
@ -2174,21 +2173,6 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i)
return false;
}
// Don't allow CPOWs to be passed to native code (in case they try to cast
// to a concrete type).
if (src.isObject() &&
jsipc::IsWrappedCPOW(&src.toObject()) &&
type_tag == nsXPTType::T_INTERFACE &&
!param_iid.Equals(NS_GET_IID(nsISupports)))
{
// Allow passing CPOWs to XPCWrappedJS.
nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS(do_QueryInterface(mCallee));
if (!wrappedJS) {
ThrowBadParam(NS_ERROR_XPC_CANT_PASS_CPOW_TO_NATIVE, i, mCallContext);
return false;
}
}
nsresult err;
if (!XPCConvert::JSData2Native(&dp->val, src, type, &param_iid, &err)) {
ThrowBadParam(err, i, mCallContext);

View File

@ -1587,10 +1587,10 @@ SpecialPowersAPI.prototype = {
var xferable = Components.classes["@mozilla.org/widget/transferable;1"].
createInstance(Components.interfaces.nsITransferable);
// in e10s b-c tests |content.window| is a CPOW whereas |window| works fine.
// in e10s b-c tests |content.window| is null whereas |window| works fine.
// for some non-e10s mochi tests, |window| is null whereas |content.window|
// works fine. So we take whatever is non-null!
xferable.init(this._getDocShell(typeof(window) == "undefined" ? content.window : window)
xferable.init(this._getDocShell(content.window || window)
.QueryInterface(Components.interfaces.nsILoadContext));
xferable.addDataFlavor(flavor);
this._cb.getData(xferable, whichClipboard);

View File

@ -222,6 +222,9 @@ AboutProtocolChannel.prototype = {
let rval = cpmm.sendRpcMessage("Addons:AboutProtocol:OpenChannel", {
uri: this.URI.spec,
contractID: this._contractID
}, {
notificationCallbacks: this.notificationCallbacks,
loadGroupNotificationCallbacks: this.loadGroup ? this.loadGroup.notificationCallbacks : null,
});
if (rval.length != 1) {

View File

@ -240,8 +240,12 @@ let AboutProtocolParent = {
let module = Cc[contractID].getService(Ci.nsIAboutModule);
try {
let channel = module.newChannel(uri, null);
channel.notificationCallbacks = null;
channel.loadGroup = null;
channel.notificationCallbacks = msg.objects.notificationCallbacks;
if (msg.objects.loadGroupNotificationCallbacks) {
channel.loadGroup = {notificationCallbacks: msg.objects.loadGroupNotificationCallbacks};
} else {
channel.loadGroup = null;
}
let stream = channel.open();
let data = NetUtil.readInputStreamToString(stream, stream.available(), {});
return {
@ -421,17 +425,13 @@ let EventTargetParent = {
// If there's already an identical listener, don't do anything.
for (let i = 0; i < forType.length; i++) {
if (forType[i].listener === listener &&
forType[i].target === target &&
forType[i].useCapture === useCapture &&
forType[i].wantsUntrusted === wantsUntrusted) {
return;
}
}
forType.push({listener: listener,
target: target,
wantsUntrusted: wantsUntrusted,
useCapture: useCapture});
forType.push({listener: listener, wantsUntrusted: wantsUntrusted, useCapture: useCapture});
},
removeEventListener: function(addon, target, type, listener, useCapture) {
@ -449,9 +449,7 @@ let EventTargetParent = {
let forType = setDefault(listeners, type, []);
for (let i = 0; i < forType.length; i++) {
if (forType[i].listener === listener &&
forType[i].target === target &&
forType[i].useCapture === useCapture) {
if (forType[i].listener === listener && forType[i].useCapture === useCapture) {
forType.splice(i, 1);
NotificationTracker.remove(["event", type, useCapture, addon]);
break;
@ -479,29 +477,18 @@ let EventTargetParent = {
// Make a copy in case they call removeEventListener in the listener.
let handlers = [];
for (let {listener, target, wantsUntrusted, useCapture} of forType) {
for (let {listener, wantsUntrusted, useCapture} of forType) {
if ((wantsUntrusted || isTrusted) && useCapture == capturing) {
handlers.push([listener, target]);
handlers.push(listener);
}
}
for (let [handler, target] of handlers) {
let EventProxy = {
get: function(actualEvent, name) {
if (name == "currentTarget") {
return target;
} else {
return actualEvent[name];
}
}
};
let proxyEvent = new Proxy(event, EventProxy);
for (let handler of handlers) {
try {
if ("handleEvent" in handler) {
handler.handleEvent(proxyEvent);
handler.handleEvent(event);
} else {
handler.call(event.target, proxyEvent);
handler.call(event.target, event);
}
} catch (e) {
Cu.reportError(e);