import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1137151: Enable test for non-public ref-counted destructors on gcc 4.8 and later, r=nfroyd (f286340cea)
- Bug 1028132 - Remove mozilla::HasDangerousPublicDestructor<T>. r=mccr8 (f4922e45d7)
- Bug 1057224 - Disable MOZ_ASSERT_CLASSNAME on gcc < 4.7. r=ehsan (faf4d10f51)
- Bug 1137175 - tighten up public interface of MiscContainer; r=khuey (510bf01921)
- bit of Bug 1152551, part 2 (0f734e8824)
- Bug 1208371 - Implement operator!= for nsMainThreadPtrHandle. r=bholley (df2f2505f9)
- Bug 1228451 - Set short-lived cert lifetime to the max OCSP response lifetime. r=keeler (877f012cce)
- Bug 1231378 - part 5 - Fix uninitialized members of classes in dom/{workers,events,media,canvas}, r=smaug (442135f0ae)
- Bug 1193854 - Restoring userContextIds with the browser session - part 1 - store the userContextId in sessionStore, r=smaug, r=ttaubert (1f6fbe0653)
- Bug 1193854 - Restoring userContextIds with the browser session - part 2 - restore the UI, r=ttaubert (c5ebd875df)
- Bug 1213650 - Regression tests. r=Mossop (c09eb0f7b6)
- Bug 1225921 - Regression tests. r=billm (c3ce773354)
- Bug 1193854 - Restoring userContextIds with the browser session - part 3 - tests, r=ttaubert (de3a5f0558)
- Bug 1237081 - Remove the getter of userContextId from nsIDocShell. r=smaug (0e3a43361e)
- Bug 1232150 - Add atomics for ppc/ppc64. r=lth (0790116e87)
- Backed out changeset 1b5c66916877 (bug 1237081) for mochitest browser-chrome bustage (278ba3c0a7)
- Bug 1237081 - remove the getter of userContextId from nsIDocShell, r=smaug (51d2b9aafa)
- Bug 567365 - allow bfcache for no-cache/https r=jduell r=bz (c94d3a1c00)
- Bug 1239420 - UserContextId should be propagate to nested docShells, r=smaug (148726b883)
- Bug 1212299 part 1 - Forbid documents inside elements other than iframe from requesting fullscreen. r=smaug (6e4662c4d5)
- Bug 1212299 part 2 - Rewrite fullscreen-denied test to have a clearer structure. r=smaug (c0200a46cc)
- Bug 1212299 part 3 - Add test for requesting fullscreen from doc inside frame/object. rs=smaug (3e0c7dae0d)
- Bug 1212299 followup - Fix minor grammar issue in locale text. DONTBUILD (905b69ff0f)
- Bug 1172224 - Ensure that docshells return an appropriate value for APZ-enabled even if they don't have a presShell. r=dvander (a906aeac93)
- Bug 1244076 - Fix a crash in nsDocShell::IssueWarning by null-checking mContentViewer; r=bzbarsky (beb09e9da8)
- Bug 1210439, r=smaug (5d42d61f5c)
- Bug 1100154 - Ensure that targeted links in a private browsing window can't target non-private-browsing windows and vice versa. r=bz (ff6f7ca3ef)
- Bug 1247872. Just get our private browsing state directly off the docshells we already have instead of trying to indirect through their documents. r=smaug (48a4c98815)
This commit is contained in:
2023-09-06 15:22:39 +08:00
parent 137091cd8f
commit e5bf86fbc7
32 changed files with 542 additions and 169 deletions
+10
View File
@@ -4749,6 +4749,16 @@
<field name="mCorrespondingMenuitem">null</field>
<field name="closing">false</field>
<field name="lastAccessed">0</field>
<method name="setUserContextId">
<parameter name="aUserContextId"/>
<body>
<![CDATA[
this.linkedBrowser.setAttribute("usercontextid", aUserContextId);
this.setAttribute("usercontextid", aUserContextId);
]]>
</body>
</method>
</implementation>
<handlers>
@@ -2996,6 +2996,10 @@ let SessionStoreInternal = {
else
tabbrowser.showTab(tab);
if (tabData.userContextId) {
tab.setUserContextId(tabData.userContextId);
}
if ("attributes" in tabData) {
// Ensure that we persist tab attributes restored from previous sessions.
Object.keys(tabData.attributes).forEach(a => TabAttributes.persist(a));
+54 -32
View File
@@ -2521,20 +2521,25 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
// Assume false until we determine otherwise...
*aFullscreenAllowed = false;
// For non-browsers/apps, check that the enclosing iframe element
// has the allowfullscreen attribute set to true. If any ancestor
// iframe does not have mozallowfullscreen=true, then fullscreen is
// prohibited.
nsCOMPtr<nsPIDOMWindow> win = GetWindow();
if (!win) {
return NS_OK;
}
nsCOMPtr<Element> frameElement = win->GetFrameElementInternal();
if (frameElement &&
frameElement->IsHTMLElement(nsGkAtoms::iframe) &&
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) &&
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)) {
return NS_OK;
if (frameElement && !frameElement->IsXULElement()) {
// We do not allow document inside any containing element other
// than iframe to enter fullscreen.
if (!frameElement->IsHTMLElement(nsGkAtoms::iframe)) {
return NS_OK;
}
// If any ancestor iframe does not have allowfullscreen attribute
// set, then fullscreen is not allowed.
if (!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
@@ -3292,23 +3297,23 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
nsString customUserAgent;
nsCOMPtr<nsIDocShell_ESR38> parentAsDocShell(do_QueryInterface(parent));
if (parentAsDocShell) {
if (NS_SUCCEEDED(parentAsDocShell->GetAllowPlugins(&value))) {
if (mAllowPlugins && NS_SUCCEEDED(parentAsDocShell->GetAllowPlugins(&value))) {
SetAllowPlugins(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowJavascript(&value))) {
if (mAllowJavascript && NS_SUCCEEDED(parentAsDocShell->GetAllowJavascript(&value))) {
SetAllowJavascript(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowMetaRedirects(&value))) {
if (mAllowMetaRedirects && NS_SUCCEEDED(parentAsDocShell->GetAllowMetaRedirects(&value))) {
SetAllowMetaRedirects(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowSubframes(&value))) {
if (mAllowSubframes && NS_SUCCEEDED(parentAsDocShell->GetAllowSubframes(&value))) {
SetAllowSubframes(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowImages(&value))) {
SetAllowImages(value);
}
SetAllowMedia(parentAsDocShell->GetAllowMedia());
if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
SetAllowMedia(parentAsDocShell->GetAllowMedia() && mAllowMedia);
if (mAllowWindowControl && NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
SetAllowWindowControl(value);
}
SetAllowContentRetargeting(
@@ -3326,7 +3331,7 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
if (NS_FAILED(parentAsDocShell->GetAllowDNSPrefetch(&value))) {
value = false;
}
SetAllowDNSPrefetch(value);
SetAllowDNSPrefetch(mAllowDNSPrefetch && value);
value = parentAsDocShell->GetAffectPrivateSessionLifetime();
SetAffectPrivateSessionLifetime(value);
uint32_t flags;
@@ -3470,18 +3475,23 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
nsCOMPtr<nsIDocShell> targetDS = do_QueryInterface(aTargetItem);
nsCOMPtr<nsIDocShell> accessingDS = do_QueryInterface(aAccessingItem);
if (!!targetDS != !!accessingDS) {
// We must be able to convert both or neither to nsIDocShell.
if (!targetDS || !accessingDS) {
// We must be able to convert both to nsIDocShell.
return false;
}
if (targetDS && accessingDS &&
(targetDS->GetIsInBrowserElement() !=
accessingDS->GetIsInBrowserElement() ||
targetDS->GetAppId() != accessingDS->GetAppId())) {
if (targetDS->GetIsInBrowserElement() != accessingDS->GetIsInBrowserElement() ||
targetDS->GetAppId() != accessingDS->GetAppId()) {
return false;
}
// A private document can't access a non-private one, and vice versa.
if (static_cast<nsDocShell*>(targetDS.get())->UsePrivateBrowsing() !=
static_cast<nsDocShell*>(accessingDS.get())->UsePrivateBrowsing()) {
return false;
}
nsCOMPtr<nsIDocShellTreeItem> accessingRoot;
aAccessingItem->GetSameTypeRootTreeItem(getter_AddRefs(accessingRoot));
@@ -3984,6 +3994,7 @@ nsDocShell::AddChild(nsIDocShellTreeItem* aChild)
}
aChild->SetTreeOwner(mTreeOwner);
childDocShell->SetUserContextId(mUserContextId);
nsCOMPtr<nsIDocShell> childAsDocShell(do_QueryInterface(aChild));
if (!childAsDocShell) {
@@ -12580,13 +12591,9 @@ nsDocShell::ShouldDiscardLayoutState(nsIHttpChannel* aChannel)
}
// figure out if SH should be saving layout state
nsCOMPtr<nsISupports> securityInfo;
bool noStore = false, noCache = false;
aChannel->GetSecurityInfo(getter_AddRefs(securityInfo));
bool noStore = false;
aChannel->IsNoStoreResponse(&noStore);
aChannel->IsNoCacheResponse(&noCache);
return (noStore || (noCache && securityInfo));
return noStore;
}
NS_IMETHODIMP
@@ -13911,6 +13918,17 @@ NS_IMETHODIMP
nsDocShell::SetUserContextId(uint32_t aUserContextId)
{
mUserContextId = aUserContextId;
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> docshell = do_QueryObject(iter.GetNext());
if (!docshell || docshell->ItemType() != ItemType()) {
continue;
}
docshell->SetUserContextId(aUserContextId);
}
return NS_OK;
}
@@ -14066,7 +14084,9 @@ nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
return NS_OK;
}
*aOut = false;
// If we don't have a presShell, fall back to the default platform value of
// whether or not APZ is enabled.
*aOut = gfxPlatform::AsyncPanZoomEnabled();
return NS_OK;
}
@@ -14396,9 +14416,11 @@ nsDocShell::InFrameSwap()
NS_IMETHODIMP
nsDocShell::IssueWarning(uint32_t aWarning, bool aAsError)
{
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
if (doc) {
doc->WarnOnceAbout(nsIDocument::DeprecatedOperations(aWarning), aAsError);
if (mContentViewer) {
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
if (doc) {
doc->WarnOnceAbout(nsIDocument::DeprecatedOperations(aWarning), aAsError);
}
}
return NS_OK;
}
-1
View File
@@ -235,7 +235,6 @@ public:
NS_IMETHOD GetUseRemoteTabs(bool*) override;
NS_IMETHOD SetRemoteTabs(bool) override;
NS_IMETHOD GetOriginAttributes(JS::MutableHandle<JS::Value>) override;
NS_IMETHOD SetUserContextId(uint32_t);
// Restores a cached presentation from history (mLSHE).
// This method swaps out the content viewer and simulates loads for
+6 -1
View File
@@ -46,7 +46,7 @@ interface nsITabParent;
typedef unsigned long nsLoadFlags;
[scriptable, builtinclass, uuid(bc3524bd-023c-4fc8-ace1-472bc999fb12)]
[scriptable, builtinclass, uuid(98358234-3936-4b95-b051-fcda4e55b52d)]
interface nsIDocShell : nsIDocShellTreeItem
{
/**
@@ -1079,6 +1079,11 @@ interface nsIDocShell : nsIDocShellTreeItem
* @see https://html.spec.whatwg.org/#dom-history-scroll-restoration
*/
attribute boolean currentScrollRestorationIsManual;
/*
* Sets the user context ID for this docshell.
*/
void setUserContextId(in unsigned long aUserContextId);
};
[scriptable, builtinclass, uuid(395c6a79-80ae-4ede-9e05-93bee6c3d9a1)]
+6 -7
View File
@@ -84,8 +84,9 @@
}
function testsIterator() {
// Load a secure page with a no-store header, followed by a simple page
// On pagehide, first page should report it is not being persisted
// Load a secure page with a no-cache header, followed by a simple page.
// no-cache should not interfere with the bfcache in the way no-store
// does.
var test1DocURI = "https://example.com:443/tests/docshell/test/chrome/112564_nocache.html";
gExpected = [{type: "pagehide", persisted: true},
@@ -97,18 +98,16 @@
var test2Doc = "data:text/html,<html><head><title>test2</title></head>" +
"<body>test2</body></html>";
gExpected = [{type: "pagehide", title: "test1", persisted: false},
{type: "unload", title: "test1"},
gExpected = [{type: "pagehide", title: "test1", persisted: true},
{type: "load", title: "test2"},
{type: "pageshow", title: "test2", persisted: false}];
gBrowser.loadURI(test2Doc);
yield undefined;
// Now go back in history. First page should not have been cached.
// Now go back in history. First page has been cached.
// Check persisted property to confirm
gExpected = [{type: "pagehide", title: "test2", persisted: true},
{type: "load", title: "test1"},
{type: "pageshow", title: "test1", persisted: false}];
{type: "pageshow", title: "test1", persisted: true}];
gBrowser.goBack();
yield undefined;
}
+6 -5
View File
@@ -113,7 +113,8 @@
// https no-cache
testName = "[nocache]";
// Load a page with a no-cache header
// Load a page with a no-cache header. This should not be
// restricted like no-store (bug 567365)
gBrowser.loadURI(nocacheURI);
yield undefined;
@@ -141,19 +142,19 @@
yield undefined;
// Now go back in history. First page should not have been cached.
// Now go back in history to the cached page.
gBrowser.goBack();
yield undefined;
// First uncacheable page will now be reloaded. Check scroll position
// restored, and form contents not
// First page will now be reloaded. Check scroll position
// and form contents are restored
is(gBrowser.contentWindow.scrollX, scrollX, testName +
" horizontal axis scroll position not correctly restored");
is(gBrowser.contentWindow.scrollY, scrollY, testName +
" vertical axis scroll position not correctly restored");
var formValue = gBrowser.contentDocument.getElementById("inp").value;
isnot(formValue, text, testName + " form value incorrectly restored");
is(formValue, text, testName + " form value not correctly restored");
// nextTest has to be called from here, as no events are fired in this
// step
+9 -9
View File
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -8,18 +10,11 @@
#include <stdint.h>
#include "nsAttrValue.h"
#include "mozilla/Attributes.h"
struct MiscContainer;
namespace mozilla {
template<>
struct HasDangerousPublicDestructor<MiscContainer>
{
static const bool value = true;
};
}
struct MiscContainer
struct MiscContainer final
{
typedef nsAttrValue::ValueType ValueType;
@@ -70,6 +65,10 @@ struct MiscContainer
mValue.mCached = 0;
}
protected:
// Only nsAttrValue should be able to delete us.
friend class nsAttrValue;
~MiscContainer()
{
if (IsRefCounted()) {
@@ -79,6 +78,7 @@ struct MiscContainer
MOZ_COUNT_DTOR(MiscContainer);
}
public:
bool GetString(nsAString& aString) const;
inline bool IsRefCounted() const
+6 -9
View File
@@ -11961,18 +11961,15 @@ nsDocument::IsFullScreenEnabled(bool aCallerIsChrome, bool aLogFailure)
return false;
}
// Ensure that all ancestor <iframe> elements have the allowfullscreen
// boolean attribute set.
// Ensure that all containing elements are <iframe> and have
// allowfullscreen attribute set.
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
bool allowed = false;
if (docShell) {
docShell->GetFullscreenAllowed(&allowed);
}
if (!allowed) {
LogFullScreenDenied(aLogFailure, "FullScreenDeniedIframeNotAllowed", this);
if (!docShell || !docShell->GetFullscreenAllowed()) {
LogFullScreenDenied(aLogFailure, "FullScreenDeniedContainerNotAllowed", this);
return false;
}
return allowed;
return true;
}
uint16_t
+1
View File
@@ -913,6 +913,7 @@ protected:
public:
ContextState() : textAlign(TextAlign::START),
textBaseline(TextBaseline::ALPHABETIC),
shadowColor(0),
lineWidth(1.0f),
miterLimit(10.0f),
globalAlpha(1.0f),
+21
View File
@@ -101,6 +101,10 @@ WebGLContextOptions::WebGLContextOptions()
WebGLContext::WebGLContext()
: WebGLContextUnchecked(nullptr)
, mBufferFetchingIsVerified(false)
, mBufferFetchingHasPerVertex(false)
, mMaxFetchedVertices(0)
, mMaxFetchedInstances(0)
, mBypassShaderValidation(false)
, mGLMaxSamples(1)
, mNeedsFakeNoAlpha(false)
@@ -112,6 +116,12 @@ WebGLContext::WebGLContext()
mShouldPresent = true;
mResetLayer = true;
mOptionsFrozen = false;
mMinCapability = false;
mDisableExtensions = false;
mIsMesa = false;
mEmitContextLostErrorOnce = false;
mWebGLError = 0;
mUnderlyingGLError = 0;
mActiveTexture = 0;
@@ -127,6 +137,17 @@ WebGLContext::WebGLContext()
mFakeVertexAttrib0BufferObject = 0;
mFakeVertexAttrib0BufferStatus = WebGLVertexAttrib0Status::Default;
mStencilRefFront = 0;
mStencilRefBack = 0;
mStencilValueMaskFront = 0;
mStencilValueMaskBack = 0;
mStencilWriteMaskFront = 0;
mStencilWriteMaskBack = 0;
mDepthWriteMask = 0;
mStencilClearValue = 0;
mDepthClearValue = 0;
mContextLostErrorSet = false;
mViewportX = 0;
mViewportY = 0;
mViewportWidth = 0;
+2
View File
@@ -20,6 +20,8 @@ WebGLFBAttachPoint::WebGLFBAttachPoint(WebGLFramebuffer* fb, GLenum attachmentPo
: mFB(fb)
, mAttachmentPoint(attachmentPoint)
, mTexImageTarget(LOCAL_GL_NONE)
, mTexImageLayer(0)
, mTexImageLevel(0)
{ }
WebGLFBAttachPoint::~WebGLFBAttachPoint()
+3
View File
@@ -37,16 +37,19 @@ public:
}
explicit TypedEventHandler(dom::EventHandlerNonNull* aHandler)
: mBits(0)
{
Assign(aHandler, eNormal);
}
explicit TypedEventHandler(dom::OnErrorEventHandlerNonNull* aHandler)
: mBits(0)
{
Assign(aHandler, eOnError);
}
explicit TypedEventHandler(dom::OnBeforeUnloadEventHandlerNonNull* aHandler)
: mBits(0)
{
Assign(aHandler, eOnBeforeUnload);
}
+15 -2
View File
@@ -256,7 +256,20 @@ private:
bool mAllowControlCharacters;
// Hide the default constructor and copy constructor.
TextComposition() {}
TextComposition()
: mPresContext(nullptr)
, mNativeContext(nullptr)
, mCompositionStartOffset(0)
, mCompositionTargetOffset(0)
, mIsSynthesizedForTests(false)
, mIsComposing(false)
, mIsEditorHandlingEvent(false)
, mIsRequestingCommit(false)
, mIsRequestingCancel(false)
, mRequestedToCommitOrCancel(false)
, mWasNativeCompositionEndEventDiscarded(false)
, mAllowControlCharacters(false)
{}
TextComposition(const TextComposition& aOther);
/**
@@ -384,7 +397,7 @@ private:
EventMessage mEventMessage;
bool mIsSynthesizedEvent;
CompositionEventDispatcher() {};
CompositionEventDispatcher() : mIsSynthesizedEvent(false) {};
};
/**
+2 -1
View File
@@ -46,7 +46,8 @@ Gamepad::Gamepad(nsISupports* aParent,
mMapping(aMapping),
mConnected(true),
mButtons(aNumButtons),
mAxes(aNumAxes)
mAxes(aNumAxes),
mTimestamp(0)
{
for (unsigned i = 0; i < aNumButtons; i++) {
mButtons.InsertElementAt(i, new GamepadButton(mParent));
+22 -20
View File
@@ -1,22 +1,24 @@
<!DOCTYPE html>
<html>
<body onload='foo();'>
<script>
function foo() {
document.addEventListener('mozfullscreenerror',
function() {
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 allowfullscreen should be denied, but was granted!");
parent.finish();
},
false);
parent.is(document.mozFullScreenEnabled, false, "Full-screen should not be enabled, coz allowfullscreen isn't present.");
document.body.mozRequestFullScreen();
}
</script>
</body>
<head>
<meta charset="UTF-8">
</head>
<body onload="doRequestFullscreen()">
<script>
function doRequestFullscreen() {
function handler(evt) {
document.removeEventListener("mozfullscreenchange", handler);
document.removeEventListener("mozfullscreenerror", handler);
parent.is(evt.type, "mozfullscreenerror", "Request from " +
`document inside ${parent.testTargetName} should be denied`);
parent.continueTest();
}
parent.ok(!document.mozFullScreenEnabled, "Fullscreen " +
`should not be enabled in ${parent.testTargetName}`);
document.addEventListener("mozfullscreenchange", handler);
document.addEventListener("mozfullscreenerror", handler);
document.documentElement.mozRequestFullScreen();
}
</script>
</body>
</html>
+85 -51
View File
@@ -3,11 +3,12 @@
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=545812
Test DOM full-screen API.
Test DOM fullscreen API.
-->
<head>
<title>Test for Bug 545812</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="file_fullscreen-utils.js"></script>
<style>
@@ -30,66 +31,99 @@ function is(a, b, msg) {
opener.is(a, b, "[denied] " + msg);
}
var gotFullScreenChange = false;
function begin() {
document.addEventListener("mozfullscreenchange",
function() {
ok(false, "Should never receive a mozfullscreenchange event in the main window.");
gotFullScreenChange = true;
},
false);
// Request full-screen from a non trusted context (this script isn't a user
// generated event!).
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, startTest);
function startTest() {
addFullscreenErrorContinuation(
function() {
ok(!document.mozFullScreen, "Should not grant request in non-trusted context");
// Test requesting full-screen mode in a long-running user-generated event handler.
// The request in the key handler should not be granted.
window.addEventListener("keypress", keyHandler, false);
synthesizeKey("VK_A", {});
});
document.body.mozRequestFullScreen();
}
const INNER_FILE = "file_fullscreen-denied-inner.html";
function setupForInnerTest(targetName, callback) {
window.testTargetName = targetName;
window.continueTest = () => {
delete window.testTargetName;
delete window.continueTest;
callback();
};
}
function keyHandler(event) {
window.removeEventListener("keypress", keyHandler, false);
function begin() {
document.addEventListener("mozfullscreenchange", () => {
ok(false, "Should never receive " +
"a fullscreenchange event in the main window.");
});
SimpleTest.executeSoon(testIFrameWithoutAllowFullscreen);
}
// Busy loop until 2s has passed. We should then be past the 1 second threshold, and so
// our request for full-screen mode should be rejected.
var end = (new Date()).getTime() + 2000;
while ((new Date()).getTime() < end) {
; // Wait...
function testIFrameWithoutAllowFullscreen() {
// Create an iframe without an allowfullscreen attribute, whose
// contents request fullscreen. The request should be denied, and
// we should not receive a fullscreenchange event in this document.
var iframe = document.createElement("iframe");
iframe.src = INNER_FILE;
setupForInnerTest("an iframe without allowfullscreen", () => {
document.body.removeChild(iframe);
SimpleTest.executeSoon(testFrameElement);
});
document.body.appendChild(iframe);
}
function testFrameElement() {
var frameset = document.createElement("frameset");
var frame = document.createElement("frame");
frame.src = INNER_FILE;
frameset.appendChild(frame);
setupForInnerTest("a frame element", () => {
document.documentElement.removeChild(frameset);
SimpleTest.executeSoon(testObjectElement);
});
document.documentElement.appendChild(frameset);
}
function testObjectElement() {
var objectElem = document.createElement("object");
objectElem.data = INNER_FILE;
setupForInnerTest("an object element", () => {
document.body.removeChild(objectElem);
// In the following tests we want to test trust context requirement
// of fullscreen request, so temporary re-enable this pref.
SpecialPowers.pushPrefEnv({
"set":[["full-screen-api.allow-trusted-requests-only", true]]
}, testNonTrustContext);
});
document.body.appendChild(objectElem);
}
function testNonTrustContext() {
addFullscreenErrorContinuation(() => {
ok(!document.mozFullScreen,
"Should not grant request in non-trust context.");
SimpleTest.executeSoon(testLongRunningEventHandler);
});
document.documentElement.mozRequestFullScreen();
}
function testLongRunningEventHandler() {
function longRunningHandler() {
window.removeEventListener("keypress", longRunningHandler);
// Busy loop until 2s has passed. We should then be past the one
// second threshold, and so our request for fullscreen should be
// rejected.
var end = (new Date()).getTime() + 2000;
while ((new Date()).getTime() < end) {
; // Wait...
}
document.documentElement.mozRequestFullScreen();
}
addFullscreenErrorContinuation(
function() {
ok(!document.mozFullScreen, "Should not grant request in long-running event handler.");
// Disable the requirement for trusted contexts only, so the tests are easier
// to write.
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", false]]}, function() {
// 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");
iframe.src = "file_fullscreen-denied-inner.html";
document.body.appendChild(iframe);
});
});
document.body.mozRequestFullScreen();
addFullscreenErrorContinuation(() => {
ok(!document.mozFullScreen,
"Should not grant request in long-running event handler.");
// Restore the pref environment we changed before
// entering testNonTrustContext.
SpecialPowers.popPrefEnv(finish);
});
window.addEventListener("keypress", longRunningHandler);
synthesizeKey("VK_A", {});
}
function finish() {
ok(!gotFullScreenChange, "Should not ever grant a fullscreen request in this doc.");
opener.nextTest();
}
</script>
</pre>
<div id="full-screen-element"></div>
</body>
</html>
+1 -1
View File
@@ -69,7 +69,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.
FullScreenDeniedIframeNotAllowed=Request for full-screen was denied because at least one of the document's containing iframes does not have an "allowfullscreen" attribute.
FullScreenDeniedContainerNotAllowed=Request for full-screen was denied because at least one of the document's containing elements is not an iframe or 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.
+1 -1
View File
@@ -318,7 +318,7 @@ protected:
class CryptoTrack
{
public:
CryptoTrack() : mValid(false) {}
CryptoTrack() : mValid(false), mMode(0), mIVSize(0) {}
bool mValid;
int32_t mMode;
int32_t mIVSize;
+6 -1
View File
@@ -62,7 +62,12 @@ class MediaChannelStatistics;
*/
class MediaChannelStatistics {
public:
MediaChannelStatistics() { Reset(); }
MediaChannelStatistics()
: mAccumulatedBytes(0)
, mIsStarted(false)
{
Reset();
}
explicit MediaChannelStatistics(MediaChannelStatistics * aCopyFrom)
{
+1 -1
View File
@@ -1044,7 +1044,7 @@ class ProcessedMediaStream : public MediaStream
{
public:
explicit ProcessedMediaStream(DOMMediaStream* aWrapper)
: MediaStream(aWrapper), mAutofinish(false)
: MediaStream(aWrapper), mAutofinish(false), mCycleMarker(0)
{}
// Control API.
+2 -1
View File
@@ -160,7 +160,8 @@ public:
};
StreamBuffer()
: mTracksKnownTime(0)
: mGraphRate(0)
, mTracksKnownTime(0)
, mForgottenTime(0)
, mTracksDirty(false)
#ifdef DEBUG
+8
View File
@@ -198,6 +198,14 @@ protected:
*/
class MediaEnginePrefs {
public:
MediaEnginePrefs()
: mWidth(0)
, mHeight(0)
, mFPS(0)
, mMinFPS(0)
, mFreq(0)
{}
int32_t mWidth;
int32_t mHeight;
int32_t mFPS;
+2 -1
View File
@@ -10,6 +10,7 @@
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsTArray.h"
#include "nsIDOMWakeLockListener.h"
#include "nsIPowerManagerService.h"
#include "mozilla/Observer.h"
#include "Types.h"
@@ -73,7 +74,7 @@ private:
static StaticRefPtr<PowerManagerService> sSingleton;
nsTArray<nsCOMPtr<nsIDOMMozWakeLockListener> > mWakeLockListeners;
nsTArray<nsCOMPtr<nsIDOMMozWakeLockListener>> mWakeLockListeners;
int32_t mWatchdogTimeoutSecs;
};
+1
View File
@@ -3943,6 +3943,7 @@ WorkerPrivate::WorkerPrivate(JSContext* aCx,
, mPeriodicGCTimerRunning(false)
, mIdleGCTimerRunning(false)
, mWorkerScriptExecutedSuccessfully(false)
, mOnLine(false)
{
MOZ_ASSERT_IF(!IsDedicatedWorker(), !aWorkerName.IsVoid());
MOZ_ASSERT_IF(IsDedicatedWorker(), aWorkerName.IsEmpty());
+4
View File
@@ -312,6 +312,10 @@ AtomicOperations::isLockfree(int32_t size)
# include "jit/arm64/AtomicOperations-arm64.h"
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
# include "jit/mips-shared/AtomicOperations-mips-shared.h"
#elif defined(__ppc64__) || defined(__PPC64_) \
|| defined(__ppc64le__) || defined(__PPC64LE__) \
|| defined(__ppc__) || defined(__PPC__)
# include "jit/none/AtomicOperations-ppc.h"
#elif defined(JS_CODEGEN_NONE)
# include "jit/none/AtomicOperations-none.h"
#elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
+242
View File
@@ -0,0 +1,242 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* For documentation, see jit/AtomicOperations.h */
#ifndef jit_ppc_AtomicOperations_ppc_h
#define jit_ppc_AtomicOperations_ppc_h
#include "mozilla/Assertions.h"
#include "mozilla/Types.h"
#if defined(__clang__) || defined(__GNUC__)
// The default implementation tactic for gcc/clang is to use the newer
// __atomic intrinsics added for use in C++11 <atomic>. Where that
// isn't available, we use GCC's older __sync functions instead.
//
// ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS is kept as a backward
// compatible option for older compilers: enable this to use GCC's old
// __sync functions instead of the newer __atomic functions. This
// will be required for GCC 4.6.x and earlier, and probably for Clang
// 3.1, should we need to use those versions.
//#define ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
inline bool
js::jit::AtomicOperations::isLockfree8()
{
# ifndef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int8_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int16_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int32_t), 0));
# if defined(__ppc64__) || defined (__PPC64__) || \
defined(__ppc64le__) || defined (__PPC64LE__)
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int64_t), 0));
# endif
return true;
# else
return false;
# endif
}
inline void
js::jit::AtomicOperations::fenceSeqCst()
{
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
__sync_synchronize();
# else
__atomic_thread_fence(__ATOMIC_SEQ_CST);
# endif
}
template<typename T>
inline T
js::jit::AtomicOperations::loadSeqCst(T* addr)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
__sync_synchronize();
T v = *addr;
__sync_synchronize();
# else
T v;
__atomic_load(addr, &v, __ATOMIC_SEQ_CST);
# endif
return v;
}
template<typename T>
inline void
js::jit::AtomicOperations::storeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
__sync_synchronize();
*addr = val;
__sync_synchronize();
# else
__atomic_store(addr, &val, __ATOMIC_SEQ_CST);
# endif
}
template<typename T>
inline T
js::jit::AtomicOperations::compareExchangeSeqCst(T* addr, T oldval, T newval)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
return __sync_val_compare_and_swap(addr, oldval, newval);
# else
__atomic_compare_exchange(addr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return oldval;
# endif
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchAddSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
return __sync_fetch_and_add(addr, val);
# else
return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST);
# endif
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchSubSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
return __sync_fetch_and_sub(addr, val);
# else
return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST);
# endif
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchAndSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
return __sync_fetch_and_and(addr, val);
# else
return __atomic_fetch_and(addr, val, __ATOMIC_SEQ_CST);
# endif
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchOrSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
return __sync_fetch_and_or(addr, val);
# else
return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST);
# endif
}
template<typename T>
inline T
js::jit::AtomicOperations::fetchXorSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
return __sync_fetch_and_xor(addr, val);
# else
return __atomic_fetch_xor(addr, val, __ATOMIC_SEQ_CST);
# endif
}
template<typename T>
inline T
js::jit::AtomicOperations::loadSafeWhenRacy(T* addr)
{
return *addr; // FIXME (1208663): not yet safe
}
template<typename T>
inline void
js::jit::AtomicOperations::storeSafeWhenRacy(T* addr, T val)
{
*addr = val; // FIXME (1208663): not yet safe
}
inline void
js::jit::AtomicOperations::memcpySafeWhenRacy(void* dest, const void* src, size_t nbytes)
{
::memcpy(dest, src, nbytes); // FIXME (1208663): not yet safe
}
inline void
js::jit::AtomicOperations::memmoveSafeWhenRacy(void* dest, const void* src, size_t nbytes)
{
::memmove(dest, src, nbytes); // FIXME (1208663): not yet safe
}
template<typename T>
inline T
js::jit::AtomicOperations::exchangeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
T v;
__sync_synchronize();
do {
v = *addr;
} while (__sync_val_compare_and_swap(addr, v, val) != v);
return v;
# else
T v;
__atomic_exchange(addr, &val, &v, __ATOMIC_SEQ_CST);
return v;
# endif
}
template<size_t nbytes>
inline void
js::jit::RegionLock::acquire(void* addr)
{
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
while (!__sync_bool_compare_and_swap(&spinlock, 0, 1))
;
# else
uint32_t zero = 0;
uint32_t one = 1;
while (!__atomic_compare_exchange(&spinlock, &zero, &one, false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE)) {
zero = 0;
continue;
}
# endif
}
template<size_t nbytes>
inline void
js::jit::RegionLock::release(void* addr)
{
MOZ_ASSERT(AtomicOperations::loadSeqCst(&spinlock) == 1, "releasing unlocked region lock");
# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
__sync_sub_and_fetch(&spinlock, 1);
# else
uint32_t zero = 0;
__atomic_store(&spinlock, &zero, __ATOMIC_SEQ_CST);
# endif
}
# undef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
#elif defined(ENABLE_SHARED_ARRAY_BUFFER)
# error "Either disable JS shared memory, use GCC or Clang, or add code here"
#endif
#endif // jit_ppc_AtomicOperations_ppc_h
+1 -1
View File
@@ -195,8 +195,8 @@ nsJARInputThunk::IsNonBlocking(bool *nonBlocking)
nsJARChannel::nsJARChannel()
: mOpened(false)
, mContentDisposition(0)
, mAppURI(nullptr)
, mContentDisposition(0)
, mContentLength(-1)
, mLoadFlags(LOAD_NORMAL)
, mStatus(NS_OK)
+2
View File
@@ -80,6 +80,8 @@ pref("security.OCSP.enabled", 1);
pref("security.OCSP.require", false);
pref("security.OCSP.GET.enabled", false);
pref("security.pki.cert_short_lifetime_in_days", 10);
pref("security.ssl.errorReporting.enabled", false);
pref("security.ssl.errorReporting.url", "https://data.mozilla.com/submit/sslreports");
pref("security.ssl.errorReporting.automatic", false);
+3 -5
View File
@@ -3258,11 +3258,9 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
// which we must validate the cached response with the server.
else if (mLoadFlags & nsIRequest::VALIDATE_NEVER) {
LOG(("VALIDATE_NEVER set\n"));
// if no-store or if no-cache and ssl, validate cached response (see
// bug 112564 for an explanation of this logic)
if (mCachedResponseHead->NoStore() ||
(mCachedResponseHead->NoCache() && isHttps)) {
LOG(("Validating based on (no-store || (no-cache && ssl)) logic\n"));
// if no-store validate cached response (see bug 112564)
if (mCachedResponseHead->NoStore()) {
LOG(("Validating based on no-store logic\n"));
doValidation = true;
}
else {
+12 -19
View File
@@ -31,14 +31,6 @@
#include "mozilla/MacroForEach.h"
#include "mozilla/TypeTraits.h"
namespace mozilla {
template <typename T>
struct HasDangerousPublicDestructor
{
static const bool value = false;
};
}
#if defined(__clang__)
// bug 1028428 shows that at least in FreeBSD 10.0 with Clang 3.4 and libc++ 3.4,
// std::is_destructible is buggy in that it returns false when it should return true
@@ -50,8 +42,8 @@ struct HasDangerousPublicDestructor
# if MOZ_USING_LIBSTDCXX && MOZ_GCC_VERSION_AT_LEAST(4, 8, 0)
# define MOZ_HAVE_STD_IS_DESTRUCTIBLE
// Some GCC versions have an ICE when using destructors in decltype().
// Works for me on GCC 4.8.2 on Fedora 20 x86-64.
# elif MOZ_GCC_VERSION_AT_LEAST(4, 8, 2)
// Works on GCC 4.8 at least.
# elif MOZ_GCC_VERSION_AT_LEAST(4, 8, 0)
# define MOZ_CAN_USE_IS_DESTRUCTIBLE_FALLBACK
# endif
#endif
@@ -87,16 +79,9 @@ struct HasDangerousPublicDestructor
#ifdef MOZ_IS_DESTRUCTIBLE
#define MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(X) \
static_assert(!MOZ_IS_DESTRUCTIBLE(X) || \
mozilla::HasDangerousPublicDestructor<X>::value, \
static_assert(!MOZ_IS_DESTRUCTIBLE(X), \
"Reference-counted class " #X " should not have a public destructor. " \
"Try to make this class's destructor non-public. If that is really " \
"not possible, you can whitelist this class by providing a " \
"HasDangerousPublicDestructor specialization for it."); \
static_assert(!mozilla::HasDangerousPublicDestructor<X>::value || \
MOZ_IS_DESTRUCTIBLE(X), \
"Class " #X " has no public destructor. That's good! So please " \
"remove the HasDangerousPublicDestructor specialization for it.");
"Make this class's destructor non-public");
#else
#define MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(X)
#endif
@@ -155,6 +140,14 @@ private:
#define MOZ_ASSERT_CLASSNAME(_type) \
static_assert(mozilla::IsClass<_type>::value, \
"Token '" #_type "' is not a class type.")
// Older versions of gcc can't instantiate local classes in templates.
// GCC 4.7 doesn't have this problem.
#if MOZ_IS_GCC
# if !MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
# undef MOZ_ASSERT_CLASSNAME
# define MOZ_ASSERT_CLASSNAME(_type)
# endif
#endif
// Note that the following constructor/destructor logging macros are redundant
// for refcounted objects that log via the NS_LOG_ADDREF/NS_LOG_RELEASE macros.
+4
View File
@@ -285,6 +285,10 @@ public:
}
return *mPtr == *aOther.mPtr;
}
bool operator!=(const nsMainThreadPtrHandle<T>& aOther) const
{
return !operator==(aOther);
}
bool operator!() const {
return !mPtr || !*mPtr;
}