Bug 1301123 - Add assertions ensuring that documents and inner windows cannot end up with an expanded principal; r=bholley

This commit is contained in:
Ehsan Akhgari 2016-09-22 18:35:48 -04:00
Родитель e124c53ded
Коммит 1b15246964
2 изменённых файлов: 13 добавлений и 0 удалений

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

@ -11,6 +11,7 @@
#include "nsNodeInfoManager.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Telemetry.h"
#include "mozilla/dom/NodeInfo.h"
#include "mozilla/dom/NodeInfoInlines.h"
#include "nsCOMPtr.h"
@ -389,6 +390,11 @@ nsNodeInfoManager::SetDocumentPrincipal(nsIPrincipal *aPrincipal)
}
NS_ASSERTION(aPrincipal, "Must have principal by this point!");
MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsExpandedPrincipal(aPrincipal),
"Documents shouldn't have an expanded principal");
if (nsContentUtils::IsExpandedPrincipal(aPrincipal)) {
Telemetry::Accumulate(Telemetry::DOCUMENT_WITH_EXPANDED_PRINCIPAL, 1);
}
mPrincipal = aPrincipal;
}

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

@ -10490,5 +10490,12 @@
"kind": "enumerated",
"n_values": 4,
"description": "Counts the number of asm.js vs WebAssembly modules instanciations, at the time modules are getting instanciated."
},
"DOCUMENT_WITH_EXPANDED_PRINCIPAL": {
"alert_emails": ["dev-platform@lists.mozilla.org"],
"bug_numbers": [1301123],
"expires_in_version": "58",
"kind": "count",
"description": "Number of documents encountered using an expanded principal."
}
}