Backed out changeset 6d13649d2f01 (bug 1243781)

This commit is contained in:
Carsten "Tomcat" Book 2016-02-01 12:40:36 +01:00
Родитель dec75fcac9
Коммит 0cc03eb73c
4 изменённых файлов: 5 добавлений и 36 удалений

Просмотреть файл

@ -159,7 +159,6 @@ CreateException(JSContext* aCx, nsresult aRv, const nsACString& aMessage)
case NS_ERROR_MODULE_DOM_FILEHANDLE:
case NS_ERROR_MODULE_DOM_BLUETOOTH:
case NS_ERROR_MODULE_DOM_ANIM:
case NS_ERROR_MODULE_DOM_PUSH:
if (aMessage.IsEmpty()) {
return DOMException::Create(aRv);
}

Просмотреть файл

@ -105,7 +105,7 @@ public:
if (NS_SUCCEEDED(aStatus)) {
mPromise->MaybeResolve(aSuccess);
} else {
mPromise->MaybeReject(NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE);
mPromise->MaybeReject(NS_ERROR_DOM_NETWORK_ERR);
}
return NS_OK;
@ -403,7 +403,7 @@ public:
if (NS_SUCCEEDED(mStatus)) {
promise->MaybeResolve(mSuccess);
} else {
promise->MaybeReject(NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE);
promise->MaybeReject(NS_ERROR_DOM_NETWORK_ERR);
}
mProxy->CleanUp(aCx);
@ -528,7 +528,7 @@ WorkerPushSubscription::Unsubscribe(ErrorResult &aRv)
RefPtr<PromiseWorkerProxy> proxy = PromiseWorkerProxy::Create(worker, p);
if (!proxy) {
p->MaybeReject(NS_ERROR_DOM_PUSH_SERVICE_UNREACHABLE);
p->MaybeReject(NS_ERROR_DOM_NETWORK_ERR);
return p.forget();
}
@ -598,8 +598,6 @@ public:
mRawP256dhKey, mAuthSecret);
promise->MaybeResolve(sub);
}
} else if (NS_ERROR_GET_MODULE(mStatus) == NS_ERROR_MODULE_DOM_PUSH ) {
promise->MaybeReject(mStatus);
} else {
promise->MaybeReject(NS_ERROR_DOM_PUSH_ABORT_ERR);
}
@ -778,7 +776,7 @@ public:
callback->OnPushSubscriptionError(NS_OK);
return NS_OK;
}
callback->OnPushSubscriptionError(NS_ERROR_DOM_PUSH_DENIED_ERR);
callback->OnPushSubscriptionError(NS_ERROR_FAILURE);
return NS_OK;
}

Просмотреть файл

@ -38,7 +38,7 @@ http://creativecommons.org/licenses/publicdomain/
registration = yield navigator.serviceWorker.register(url, {scope: "."});
});
add_task(function* denySubscribe() {
add_task(function* setupPushNotification() {
try {
yield registration.pushManager.subscribe();
ok(false, "subscribe() should fail because no permission for push");
@ -48,17 +48,6 @@ http://creativecommons.org/licenses/publicdomain/
}
});
add_task(function* denySubscribeInWorker() {
// If permission is revoked, `getSubscription()` should return `null`, and
// `subscribe()` should reject immediately. Calling these from the worker
// should not deadlock the main thread (see bug 1228723).
var errorInfo = yield sendRequestToWorker({
type: "denySubscribe",
});
ok(errorInfo.isDOMException, "Wrong exception type");
is(errorInfo.name, "PermissionDeniedError", "Wrong exception name");
});
add_task(function* getEndpoint() {
var pushSubscription = yield registration.pushManager.getSubscription();
is(pushSubscription, null, "getSubscription() should return null because no permission for push");

Просмотреть файл

@ -97,23 +97,6 @@ function handleMessage(event) {
}));
return;
}
if (event.data.type == "denySubscribe") {
reply(event, self.registration.pushManager.getSubscription().then(
subscription => {
assert(!subscription,
"Should not return worker subscription with revoked permission");
return self.registration.pushManager.subscribe().then(_ => {
assert(false, "Expected error subscribing with revoked permission");
}, error => {
return {
isDOMException: error instanceof DOMException,
name: error.name,
};
});
}
));
return;
}
reply(event, Promise.reject(
"Invalid message type: " + event.data.type));
}