Bug 1534343 - Document should check if its mCookieSettings exists before using it, r=Ehsan

Differential Revision: https://phabricator.services.mozilla.com/D23764

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2019-03-19 06:27:45 +00:00
Родитель d0b98b2150
Коммит 13f97ffdb7
3 изменённых файлов: 29 добавлений и 3 удалений

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

@ -11830,7 +11830,7 @@ DocumentAutoplayPolicy Document::AutoplayPolicy() const {
}
void Document::MaybeAllowStorageForOpenerAfterUserInteraction() {
if (mCookieSettings->GetCookieBehavior() !=
if (CookieSettings()->GetCookieBehavior() !=
nsICookieService::BEHAVIOR_REJECT_TRACKER) {
return;
}
@ -12352,7 +12352,7 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
}
// Only enforce third-party checks when there is a reason to enforce them.
if (mCookieSettings->GetCookieBehavior() !=
if (CookieSettings()->GetCookieBehavior() !=
nsICookieService::BEHAVIOR_REJECT_TRACKER) {
// Step 3. If the document's frame is the main frame, resolve.
if (IsTopLevelContentDocument()) {
@ -12405,7 +12405,7 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
return promise.forget();
}
if (mCookieSettings->GetCookieBehavior() ==
if (CookieSettings()->GetCookieBehavior() ==
nsICookieService::BEHAVIOR_REJECT_TRACKER &&
inner) {
// Only do something special for third-party tracking content.

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

@ -11,3 +11,4 @@ support-files =
[test_sharedWorker.html]
[test_worker.html]
[test_xhr.html]
[test_xmlDocument.html]

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

@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Document constructor</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript">
SpecialPowers.pushPrefEnv({set: [
["dom.storage_access.enabled", true],
]}).then(_ => {
const doc = new Document();
doc.requestStorageAccess().catch(__ => {}).then(___ => {
ok(true, "No crash!");
SimpleTest.finish();
});
});
SimpleTest.waitForExplicitFinish();
</script>
</body>
</html>