Skip to content

Commit

Permalink
Bug 805301 - Rename iframe.mozallowfullscreen to allowfullscreen. r=j…
Browse files Browse the repository at this point in the history
…lebar
  • Loading branch information
Chris Pearce committed Oct 29, 2012
1 parent 74d047c commit 046c7a9
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 36 deletions.
4 changes: 2 additions & 2 deletions b2g/chrome/content/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ var shell = {

let manifestURL = this.manifestURL;
// <html:iframe id="homescreen"
// mozbrowser="true" mozallowfullscreen="true"
// mozbrowser="true" allowfullscreen="true"
// style="overflow: hidden; -moz-box-flex: 1; border: none;"
// src="data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;'>"/>
let browserFrame =
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:iframe');
browserFrame.setAttribute('id', 'homescreen');
browserFrame.setAttribute('mozbrowser', 'true');
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('src', "data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;");
document.getElementById('shell').appendChild(browserFrame);
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/test/test_contextmenu.html
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@
return;
}

subwindow.mozAllowFullScreen = true;
subwindow.allowfullscreen = true;
lastElement = null;

text = subwindow.document.getElementById("test-text");
Expand Down
2 changes: 1 addition & 1 deletion content/base/src/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9058,7 +9058,7 @@ nsDocument::IsFullScreenEnabled(bool aCallerIsChrome, bool aLogFailure)
return false;
}

// Ensure that all ancestor <iframe> elements have the mozallowfullscreen
// Ensure that all ancestor <iframe> elements have the allowfullscreen
// boolean attribute set.
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
bool allowed = false;
Expand Down
1 change: 1 addition & 0 deletions content/base/src/nsGkAtomList.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ GK_ATOM(all, "all")
GK_ATOM(allowevents, "allowevents")
GK_ATOM(allowforms, "allow-forms")
GK_ATOM(allownegativeassertions, "allownegativeassertions")
GK_ATOM(allowfullscreen, "allowfullscreen")
GK_ATOM(allowsameorigin, "allow-same-origin")
GK_ATOM(allowscripts, "allow-scripts")
GK_ATOM(allowtopnavigation, "allow-top-navigation")
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/src/nsHTMLIFrameElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Name, name)
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Scrolling, scrolling)
NS_IMPL_URI_ATTR(nsHTMLIFrameElement, Src, src)
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)

void
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/file_fullscreen-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
is(event.target, document, "10. Event target should be full-screen document #2");
is(document.mozFullScreenElement, null, "11. Full-screen element should be null.");
iframe = document.createElement("iframe");
iframe.mozAllowFullScreen = true;
iframe.allowfullscreen = true;
addFullscreenChangeContinuation("enter", enter2);
document.body.appendChild(iframe);
iframe.src = iframeContents;
Expand Down
6 changes: 3 additions & 3 deletions content/html/content/test/file_fullscreen-denied-inner.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
function foo() {
document.addEventListener('mozfullscreenerror',
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();
},
false);
document.addEventListener('mozfullscreenchange',
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();
},
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();
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/file_fullscreen-denied.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
// to write.
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
// event in this document.
var iframe = document.createElement("iframe");
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/file_fullscreen-hidden.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</head>
<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>
<p id="display"></p>
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/file_fullscreen-navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</head>
<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>
<p id="display"></p>
Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/file_fullscreen-rollback.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<div id="fse">
<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>

Expand Down
2 changes: 1 addition & 1 deletion content/html/content/test/test_fullscreen-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);

// 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.
var gTestWindows = [
"file_fullscreen-rollback.html",
Expand Down
7 changes: 4 additions & 3 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2150,8 +2150,8 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
*aFullscreenAllowed = false;

// For non-content boundaries, check that the enclosing iframe element
// has the mozallowfullscreen attribute set to true. If any ancestor
// iframe does not have mozallowfullscreen=true, then fullscreen is
// has the allowfullscreen attribute set to true. If any ancestor
// iframe does not have allowfullscreen=true, then fullscreen is
// prohibited.
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(GetAsSupports(this));
if (!win) {
Expand All @@ -2160,12 +2160,13 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
nsCOMPtr<nsIContent> frameElement = do_QueryInterface(win->GetFrameElementInternal());
if (frameElement &&
frameElement->IsHTML(nsGkAtoms::iframe) &&
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) &&
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)) {
return NS_OK;
}

// 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.
nsCOMPtr<nsIDocShellTreeItem> dsti = do_GetInterface(GetAsSupports(this));
NS_ENSURE_TRUE(dsti, NS_OK);
Expand Down
8 changes: 4 additions & 4 deletions docshell/base/nsDocShell.h
Original file line number Diff line number Diff line change
Expand Up @@ -772,14 +772,14 @@ class nsDocShell : public nsDocLoader,

// mFullscreenAllowed stores how we determine whether fullscreen is allowed
// 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
// 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
// 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
// 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
// is set otherwise when docshells which are content boundaries are created.
enum FullscreenAllowedState {
Expand Down
4 changes: 2 additions & 2 deletions docshell/base/nsIDocShell.idl
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ interface nsIDocShell : nsISupports
/**
* 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 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
* 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
* exception.
*/
Expand Down
5 changes: 3 additions & 2 deletions dom/browser-element/BrowserElementParent.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,10 @@ BrowserElementParent.prototype = {
_recvGetName: function(data) {
return this._frameElement.getAttribute('name');
},

_recvGetFullscreenAllowed: function(data) {
return this._frameElement.hasAttribute('mozallowfullscreen');
return this._frameElement.hasAttribute('allowfullscreen') ||
this._frameElement.hasAttribute('mozallowfullscreen');
},

_fireCtxMenuEvent: function(data) {
Expand Down
2 changes: 1 addition & 1 deletion dom/interfaces/core/nsIDOMDocument.idl
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ interface nsIDOMDocument : nsIDOMNode
/**
* Denotes whether the full-screen-api.enabled is true, no windowed
* 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>
*/
Expand Down
6 changes: 3 additions & 3 deletions dom/interfaces/html/nsIDOMHTMLIFrameElement.idl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* 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
{
attribute DOMString align;
Expand All @@ -35,8 +35,8 @@ interface nsIDOMHTMLIFrameElement : nsIDOMHTMLElement

attribute DOMString sandbox;
// 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
// mode. See https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI
attribute boolean mozAllowFullScreen;
attribute boolean allowfullscreen;
};
2 changes: 1 addition & 1 deletion dom/locales/en-US/chrome/dom/dom.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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.
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.
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Mozilla Bug 784402</a>
<p id="display"></p>

<iframe src ="iframe_differentDOM.html" mozallowfullscreen="true" id="iframe"
<iframe src ="iframe_differentDOM.html" allowfullscreen="true" id="iframe"
onload="startTest()"
sandbox="allow-scripts allow-same-origin allow-pointer-lock">
</iframe>
Expand Down
10 changes: 5 additions & 5 deletions dom/tests/mochitest/pointerlock/test_pointerlock-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Pointer Lock tests for bug 633602. These depend on the fullscreen api
* 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.
* This method is borrowed from content/html/content/test/test_fullscreen-api.html.
**/
Expand All @@ -36,10 +36,10 @@
// Grant "fullscreen" permission on the test domain. This means fullscreen will be
// automatically approved, so pointer lock in the tests will be too.
SpecialPowers.setFullscreenAllowed(document);

// Run the tests which go full-screen in new window, as Mochitests
// 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 = [
"file_approval.html",
"file_screenClientXYConst.html",
Expand Down Expand Up @@ -72,11 +72,11 @@

function finish() {
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)
SimpleTest.finish();
}

function nextTest() {
if (isWinXP) {
todo(false, "Can't reliably run full-screen tests on Windows XP due to bug 704010");
Expand Down

0 comments on commit 046c7a9

Please sign in to comment.