mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 753546 Part 1 - Make nsDocument listen for 'fullscreen-approved' notification rather than 'perm-changed' to signal fullscreen approved. r=smaug
This commit is contained in:
parent
1c10357a1d
commit
f0483c44f2
@ -9257,7 +9257,7 @@ nsDocument::ClearPendingPointerLockRequest(bool aDispatchErrorEvents)
|
||||
NS_WARNING("Document must implement nsIObserver");
|
||||
return;
|
||||
}
|
||||
os->RemoveObserver(obs, "perm-changed");
|
||||
os->RemoveObserver(obs, "fullscreen-approved");
|
||||
|
||||
if (aDispatchErrorEvents) {
|
||||
DispatchPointerLockError(doc);
|
||||
@ -9291,7 +9291,7 @@ nsDocument::SetPendingPointerLockRequest(Element* aElement)
|
||||
nsCOMPtr<nsIObserver> obs(do_QueryInterface(aElement->OwnerDoc()));
|
||||
NS_ENSURE_TRUE(obs != nsnull, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult res = os->AddObserver(obs, "perm-changed", true);
|
||||
nsresult res = os->AddObserver(obs, "fullscreen-approved", true);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
sPendingPointerLockDoc = do_GetWeakReference(aElement->OwnerDoc());
|
||||
@ -9309,9 +9309,10 @@ nsDocument::Observe(nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
const PRUnichar *aData)
|
||||
{
|
||||
if (strcmp("perm-changed", aTopic) == 0) {
|
||||
if (strcmp("fullscreen-approved", aTopic) == 0) {
|
||||
nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryReferent(sPendingPointerLockDoc));
|
||||
if (nsContentUtils::IsSitePermAllow(doc->NodePrincipal(), "fullscreen")) {
|
||||
if (subject == doc) {
|
||||
nsCOMPtr<Element> element(do_QueryReferent(sPendingPointerLockElement));
|
||||
nsDocument::ClearPendingPointerLockRequest(false);
|
||||
nsAsyncPointerLockRequest::Request(element, doc);
|
||||
@ -9337,7 +9338,7 @@ nsDocument::RequestPointerLock(Element* aElement)
|
||||
DispatchPointerLockError(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!nsContentUtils::IsSitePermAllow(NodePrincipal(), "fullscreen")) {
|
||||
// Domain isn't yet approved for fullscreen, so we must wait until
|
||||
// it's been approved.
|
||||
|
@ -1041,6 +1041,9 @@ SpecialPowersAPI.prototype = {
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
|
||||
var uri = this.getDocumentURIObject(document);
|
||||
pm.add(uri, "fullscreen", Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
var obsvc = Cc['@mozilla.org/observer-service;1']
|
||||
.getService(Ci.nsIObserverService);
|
||||
obsvc.notifyObservers(document, "fullscreen-approved", null);
|
||||
},
|
||||
|
||||
removeFullscreenAllowed: function(document) {
|
||||
|
Loading…
Reference in New Issue
Block a user