Bug 805301 - Rename iframe.mozallowfullscreen to allowfullscreen. r=jlebar

This commit is contained in:
Chris Pearce 2012-10-30 11:02:24 +13:00
parent f6779af6bd
commit 818603ae1d
21 changed files with 39 additions and 36 deletions

View File

@ -158,7 +158,7 @@ var shell = {
let manifestURL = this.manifestURL; let manifestURL = this.manifestURL;
// <html:iframe id="homescreen" // <html:iframe id="homescreen"
// mozbrowser="true" mozallowfullscreen="true" // mozbrowser="true" allowfullscreen="true"
// style="overflow: hidden; -moz-box-flex: 1; border: none;" // style="overflow: hidden; -moz-box-flex: 1; border: none;"
// src="data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;'>"/> // src="data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;'>"/>
let browserFrame = let browserFrame =
@ -166,7 +166,7 @@ var shell = {
browserFrame.setAttribute('id', 'homescreen'); browserFrame.setAttribute('id', 'homescreen');
browserFrame.setAttribute('mozbrowser', 'true'); browserFrame.setAttribute('mozbrowser', 'true');
browserFrame.setAttribute('mozapp', manifestURL); browserFrame.setAttribute('mozapp', manifestURL);
browserFrame.setAttribute('mozallowfullscreen', 'true'); browserFrame.setAttribute('allowfullscreen', 'true');
browserFrame.setAttribute('style', "overflow: hidden; -moz-box-flex: 1; border: none;"); browserFrame.setAttribute('style', "overflow: hidden; -moz-box-flex: 1; border: none;");
browserFrame.setAttribute('src', "data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;"); browserFrame.setAttribute('src', "data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;");
document.getElementById('shell').appendChild(browserFrame); document.getElementById('shell').appendChild(browserFrame);

View File

@ -880,7 +880,7 @@ function startTest() {
return; return;
} }
subwindow.mozAllowFullScreen = true; subwindow.allowfullscreen = true;
lastElement = null; lastElement = null;
text = subwindow.document.getElementById("test-text"); text = subwindow.document.getElementById("test-text");

View File

@ -9058,7 +9058,7 @@ nsDocument::IsFullScreenEnabled(bool aCallerIsChrome, bool aLogFailure)
return false; return false;
} }
// Ensure that all ancestor <iframe> elements have the mozallowfullscreen // Ensure that all ancestor <iframe> elements have the allowfullscreen
// boolean attribute set. // boolean attribute set.
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer); nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
bool allowed = false; bool allowed = false;

View File

@ -73,6 +73,7 @@ GK_ATOM(all, "all")
GK_ATOM(allowevents, "allowevents") GK_ATOM(allowevents, "allowevents")
GK_ATOM(allowforms, "allow-forms") GK_ATOM(allowforms, "allow-forms")
GK_ATOM(allownegativeassertions, "allownegativeassertions") GK_ATOM(allownegativeassertions, "allownegativeassertions")
GK_ATOM(allowfullscreen, "allowfullscreen")
GK_ATOM(allowsameorigin, "allow-same-origin") GK_ATOM(allowsameorigin, "allow-same-origin")
GK_ATOM(allowscripts, "allow-scripts") GK_ATOM(allowscripts, "allow-scripts")
GK_ATOM(allowtopnavigation, "allow-top-navigation") GK_ATOM(allowtopnavigation, "allow-top-navigation")

View File

@ -55,7 +55,7 @@ NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Name, name)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Scrolling, scrolling) NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Scrolling, scrolling)
NS_IMPL_URI_ATTR(nsHTMLIFrameElement, Src, src) NS_IMPL_URI_ATTR(nsHTMLIFrameElement, Src, src)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Width, width) NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Width, width)
NS_IMPL_BOOL_ATTR(nsHTMLIFrameElement, MozAllowFullScreen, mozallowfullscreen) NS_IMPL_BOOL_ATTR(nsHTMLIFrameElement, Allowfullscreen, allowfullscreen)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Sandbox, sandbox) NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Sandbox, sandbox)
void void

View File

@ -78,7 +78,7 @@ function exit1(event) {
is(event.target, document, "10. Event target should be full-screen document #2"); is(event.target, document, "10. Event target should be full-screen document #2");
is(document.mozFullScreenElement, null, "11. Full-screen element should be null."); is(document.mozFullScreenElement, null, "11. Full-screen element should be null.");
iframe = document.createElement("iframe"); iframe = document.createElement("iframe");
iframe.mozAllowFullScreen = true; iframe.allowfullscreen = true;
addFullscreenChangeContinuation("enter", enter2); addFullscreenChangeContinuation("enter", enter2);
document.body.appendChild(iframe); document.body.appendChild(iframe);
iframe.src = iframeContents; iframe.src = iframeContents;

View File

@ -4,17 +4,17 @@
function foo() { function foo() {
document.addEventListener('mozfullscreenerror', document.addEventListener('mozfullscreenerror',
function() { function() {
parent.ok(true, "Request from an iframe without mozallowfullscreen should be denied"); parent.ok(true, "Request from an iframe without allowfullscreen should be denied");
parent.finish(); parent.finish();
}, },
false); false);
document.addEventListener('mozfullscreenchange', document.addEventListener('mozfullscreenchange',
function() { function() {
parent.ok(false, "Request from an iframe without mozallowfullscreen should be denied, but was granted!"); parent.ok(false, "Request from an iframe without allowfullscreen should be denied, but was granted!");
parent.finish(); parent.finish();
}, },
false); false);
parent.is(document.mozFullScreenEnabled, false, "Full-screen should not be enabled, coz mozallowfullscreen isn't present."); parent.is(document.mozFullScreenEnabled, false, "Full-screen should not be enabled, coz allowfullscreen isn't present.");
document.body.mozRequestFullScreen(); document.body.mozRequestFullScreen();
} }
</script> </script>

View File

@ -71,7 +71,7 @@ function keyHandler(event) {
// to write. // to write.
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false); SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
// Create an iframe without a mozallowfullscreen attribute, whose contents requests // Create an iframe without a allowfullscreen attribute, whose contents requests
// full-screen. The request should be denied, and we should not receive a fullscreenchange // full-screen. The request should be denied, and we should not receive a fullscreenchange
// event in this document. // event in this document.
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");

View File

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=697636
</head> </head>
<body> <body>
<iframe id="f" src="data:text/html,<body text=green>1" mozallowfullscreen></iframe> <iframe id="f" src="data:text/html,<body text=green>1" allowfullscreen></iframe>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=697636">Mozilla Bug 697636</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=697636">Mozilla Bug 697636</a>
<p id="display"></p> <p id="display"></p>

View File

@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=685402
</head> </head>
<body style="background-color: gray;"> <body style="background-color: gray;">
<iframe id="f" src="data:text/html,<body text=green>1" mozallowfullscreen></iframe> <iframe id="f" src="data:text/html,<body text=green>1" allowfullscreen></iframe>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685402">Mozilla Bug 685402</a> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=685402">Mozilla Bug 685402</a>
<p id="display"></p> <p id="display"></p>

View File

@ -26,7 +26,7 @@ Tests:
<div id="fse"> <div id="fse">
<div id="fse-inner"> <div id="fse-inner">
<iframe id="subdoc" mozallowfullscreen src="data:text/html,<html><body bgcolor='black'></body></html>"></iframe> <iframe id="subdoc" allowfullscreen src="data:text/html,<html><body bgcolor='black'></body></html>"></iframe>
</div> </div>
</div> </div>

View File

@ -31,7 +31,7 @@ SpecialPowers.setBoolPref("full-screen-api.enabled", true);
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false); SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
// Run the tests which go full-screen in new windows, as mochitests normally // Run the tests which go full-screen in new windows, as mochitests normally
// run in an iframe, which by default will not have the mozallowfullscreen // run in an iframe, which by default will not have the allowfullscreen
// attribute set, so full-screen won't work. // attribute set, so full-screen won't work.
var gTestWindows = [ var gTestWindows = [
"file_fullscreen-rollback.html", "file_fullscreen-rollback.html",

View File

@ -2150,8 +2150,8 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
*aFullscreenAllowed = false; *aFullscreenAllowed = false;
// For non-content boundaries, check that the enclosing iframe element // For non-content boundaries, check that the enclosing iframe element
// has the mozallowfullscreen attribute set to true. If any ancestor // has the allowfullscreen attribute set to true. If any ancestor
// iframe does not have mozallowfullscreen=true, then fullscreen is // iframe does not have allowfullscreen=true, then fullscreen is
// prohibited. // prohibited.
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(GetAsSupports(this)); nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(GetAsSupports(this));
if (!win) { if (!win) {
@ -2160,12 +2160,13 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
nsCOMPtr<nsIContent> frameElement = do_QueryInterface(win->GetFrameElementInternal()); nsCOMPtr<nsIContent> frameElement = do_QueryInterface(win->GetFrameElementInternal());
if (frameElement && if (frameElement &&
frameElement->IsHTML(nsGkAtoms::iframe) && frameElement->IsHTML(nsGkAtoms::iframe) &&
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) &&
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)) { !frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)) {
return NS_OK; return NS_OK;
} }
// If we have no parent then we're the root docshell; no ancestor of the // If we have no parent then we're the root docshell; no ancestor of the
// original docshell doesn't have a mozallowfullscreen attribute, so // original docshell doesn't have a allowfullscreen attribute, so
// report fullscreen as allowed. // report fullscreen as allowed.
nsCOMPtr<nsIDocShellTreeItem> dsti = do_GetInterface(GetAsSupports(this)); nsCOMPtr<nsIDocShellTreeItem> dsti = do_GetInterface(GetAsSupports(this));
NS_ENSURE_TRUE(dsti, NS_OK); NS_ENSURE_TRUE(dsti, NS_OK);

View File

@ -772,14 +772,14 @@ protected:
// mFullscreenAllowed stores how we determine whether fullscreen is allowed // mFullscreenAllowed stores how we determine whether fullscreen is allowed
// when GetFullscreenAllowed() is called. Fullscreen is allowed in a // when GetFullscreenAllowed() is called. Fullscreen is allowed in a
// docshell when all containing iframes have the mozallowfullscreen // docshell when all containing iframes have the allowfullscreen
// attribute set to true. When mFullscreenAllowed is CHECK_ATTRIBUTES // attribute set to true. When mFullscreenAllowed is CHECK_ATTRIBUTES
// we check this docshell's containing frame for the mozallowfullscreen // we check this docshell's containing frame for the allowfullscreen
// attribute, and recurse onto the parent docshell to ensure all containing // attribute, and recurse onto the parent docshell to ensure all containing
// frames also have the mozallowfullscreen attribute. If we find an ancestor // frames also have the allowfullscreen attribute. If we find an ancestor
// docshell with mFullscreenAllowed not equal to CHECK_ATTRIBUTES, we've // docshell with mFullscreenAllowed not equal to CHECK_ATTRIBUTES, we've
// reached a content boundary, and mFullscreenAllowed denotes whether the // reached a content boundary, and mFullscreenAllowed denotes whether the
// parent across the content boundary has mozallowfullscreen=true in all its // parent across the content boundary has allowfullscreen=true in all its
// containing iframes. mFullscreenAllowed defaults to CHECK_ATTRIBUTES and // containing iframes. mFullscreenAllowed defaults to CHECK_ATTRIBUTES and
// is set otherwise when docshells which are content boundaries are created. // is set otherwise when docshells which are content boundaries are created.
enum FullscreenAllowedState { enum FullscreenAllowedState {

View File

@ -690,10 +690,10 @@ interface nsIDocShell : nsISupports
/** /**
* Attribute that determines whether fullscreen is allowed to be entered for * Attribute that determines whether fullscreen is allowed to be entered for
* this subtree of the docshell tree. This is true when all iframes containing * this subtree of the docshell tree. This is true when all iframes containing
* this docshell have their "mozallowfullscreen" attribute set to "true". * this docshell have their "allowfullscreen" attribute set to "true".
* fullscreenAllowed is only writable at content boundaries, where it is used * fullscreenAllowed is only writable at content boundaries, where it is used
* to propagate the value of the cross process parent's iframe's * to propagate the value of the cross process parent's iframe's
* "mozallowfullscreen" attribute to the child process. Setting * "allowfullscreen" attribute to the child process. Setting
* fullscreenAllowed on docshells which aren't content boundaries throws an * fullscreenAllowed on docshells which aren't content boundaries throws an
* exception. * exception.
*/ */

View File

@ -371,9 +371,10 @@ BrowserElementParent.prototype = {
_recvGetName: function(data) { _recvGetName: function(data) {
return this._frameElement.getAttribute('name'); return this._frameElement.getAttribute('name');
}, },
_recvGetFullscreenAllowed: function(data) { _recvGetFullscreenAllowed: function(data) {
return this._frameElement.hasAttribute('mozallowfullscreen'); return this._frameElement.hasAttribute('allowfullscreen') ||
this._frameElement.hasAttribute('mozallowfullscreen');
}, },
_fireCtxMenuEvent: function(data) { _fireCtxMenuEvent: function(data) {

View File

@ -353,7 +353,7 @@ interface nsIDOMDocument : nsIDOMNode
/** /**
* Denotes whether the full-screen-api.enabled is true, no windowed * Denotes whether the full-screen-api.enabled is true, no windowed
* plugins are present, and all ancestor documents have the * plugins are present, and all ancestor documents have the
* mozallowfullscreen attribute set. * allowfullscreen attribute set.
* *
* @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
*/ */

View File

@ -16,7 +16,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/ * http://www.whatwg.org/specs/web-apps/current-work/
*/ */
[scriptable, uuid(52f6244b-b1f5-4f4c-8ff3-7e146316f411)] [scriptable, uuid(a7bd1e34-3969-47ae-8c1d-2970132ba925)]
interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement
{ {
attribute DOMString align; attribute DOMString align;
@ -35,8 +35,8 @@ interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement
attribute DOMString sandbox; attribute DOMString sandbox;
// Mozilla extensions // Mozilla extensions
// iframe elements require the mozAllowFullScreen attribute to be present // iframe elements require the allowfullscreen attribute to be present
// if they're to allow content in the sub document to go into DOM full-screen // if they're to allow content in the sub document to go into DOM full-screen
// mode. See https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI // mode. See https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI
attribute boolean mozAllowFullScreen; attribute boolean allowfullscreen;
}; };

View File

@ -72,7 +72,7 @@ FullScreenDeniedBlocked=Request for full-screen was denied because this domain h
FullScreenDeniedDisabled=Request for full-screen was denied because full-screen API is disabled by user preference. FullScreenDeniedDisabled=Request for full-screen was denied because full-screen API is disabled by user preference.
FullScreenDeniedFocusedPlugin=Request for full-screen was denied because a windowed plugin is focused. FullScreenDeniedFocusedPlugin=Request for full-screen was denied because a windowed plugin is focused.
FullScreenDeniedHidden=Request for full-screen was denied because the document is no longer visible. FullScreenDeniedHidden=Request for full-screen was denied because the document is no longer visible.
FullScreenDeniedIframeDisallowed=Request for full-screen was denied because at least one of the document's containing iframes does not have a "mozallowfullscreen" attribute. FullScreenDeniedIframeDisallowed=Request for full-screen was denied because at least one of the document's containing iframes does not have an "allowfullscreen" attribute.
FullScreenDeniedNotInputDriven=Request for full-screen was denied because Element.mozRequestFullScreen() was not called from inside a short running user-generated event handler. FullScreenDeniedNotInputDriven=Request for full-screen was denied because Element.mozRequestFullScreen() was not called from inside a short running user-generated event handler.
FullScreenDeniedNotInDocument=Request for full-screen was denied because requesting element is no longer in its document. FullScreenDeniedNotInDocument=Request for full-screen was denied because requesting element is no longer in its document.
FullScreenDeniedMovedDocument=Request for full-screen was denied because requesting element has moved document. FullScreenDeniedMovedDocument=Request for full-screen was denied because requesting element has moved document.

View File

@ -18,7 +18,7 @@
Mozilla Bug 784402</a> Mozilla Bug 784402</a>
<p id="display"></p> <p id="display"></p>
<iframe src ="iframe_differentDOM.html" mozallowfullscreen="true" id="iframe" <iframe src ="iframe_differentDOM.html" allowfullscreen="true" id="iframe"
onload="startTest()" onload="startTest()"
sandbox="allow-scripts allow-same-origin allow-pointer-lock"> sandbox="allow-scripts allow-same-origin allow-pointer-lock">
</iframe> </iframe>

View File

@ -20,7 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
/** /**
* Pointer Lock tests for bug 633602. These depend on the fullscreen api * Pointer Lock tests for bug 633602. These depend on the fullscreen api
* which doesn't work when run in the mochitests' iframe, since the * which doesn't work when run in the mochitests' iframe, since the
* mochitests' iframe doesn't have a mozallowfullscreen attribute. To get * mochitests' iframe doesn't have an allowfullscreen attribute. To get
* around this, all tests are run in a child window, which can go fullscreen. * around this, all tests are run in a child window, which can go fullscreen.
* This method is borrowed from content/html/content/test/test_fullscreen-api.html. * This method is borrowed from content/html/content/test/test_fullscreen-api.html.
**/ **/
@ -36,10 +36,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
// Grant "fullscreen" permission on the test domain. This means fullscreen will be // Grant "fullscreen" permission on the test domain. This means fullscreen will be
// automatically approved, so pointer lock in the tests will be too. // automatically approved, so pointer lock in the tests will be too.
SpecialPowers.setFullscreenAllowed(document); SpecialPowers.setFullscreenAllowed(document);
// Run the tests which go full-screen in new window, as Mochitests // Run the tests which go full-screen in new window, as Mochitests
// normally run in an iframe, which by default will not have the // normally run in an iframe, which by default will not have the
// mozallowfullscreen attribute set, so full-screen won't work. // allowfullscreen attribute set, so full-screen won't work.
var gTestFiles = [ var gTestFiles = [
"file_approval.html", "file_approval.html",
"file_screenClientXYConst.html", "file_screenClientXYConst.html",
@ -72,11 +72,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
function finish() { function finish() {
SpecialPowers.clearUserPref("full-screen-api.enabled"); SpecialPowers.clearUserPref("full-screen-api.enabled");
SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only"); SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
SpecialPowers.removeFullscreenAllowed(document) SpecialPowers.removeFullscreenAllowed(document)
SimpleTest.finish(); SimpleTest.finish();
} }
function nextTest() { function nextTest() {
if (isWinXP) { if (isWinXP) {
todo(false, "Can't reliably run full-screen tests on Windows XP due to bug 704010"); todo(false, "Can't reliably run full-screen tests on Windows XP due to bug 704010");