зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1549057 - Rename (Gg)etCSP to (Gg)etCsp - r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D159268
This commit is contained in:
Родитель
ceb646d15d
Коммит
3c5991df13
|
@ -3643,8 +3643,8 @@ var browserDragAndDrop = {
|
|||
return Services.droppedLinkHandler.getTriggeringPrincipal(aEvent);
|
||||
},
|
||||
|
||||
getCSP(aEvent) {
|
||||
return Services.droppedLinkHandler.getCSP(aEvent);
|
||||
getCsp(aEvent) {
|
||||
return Services.droppedLinkHandler.getCsp(aEvent);
|
||||
},
|
||||
|
||||
validateURIsForDrop(aEvent, aURIs) {
|
||||
|
@ -3737,7 +3737,7 @@ var newTabButtonObserver = {
|
|||
|
||||
let where = aEvent.shiftKey ? "tabshifted" : "tab";
|
||||
let triggeringPrincipal = browserDragAndDrop.getTriggeringPrincipal(aEvent);
|
||||
let csp = browserDragAndDrop.getCSP(aEvent);
|
||||
let csp = browserDragAndDrop.getCsp(aEvent);
|
||||
for (let link of links) {
|
||||
if (link.url) {
|
||||
let data = await UrlbarUtils.getShortcutOrURIAndPostData(link.url);
|
||||
|
@ -3774,7 +3774,7 @@ var newWindowButtonObserver = {
|
|||
}
|
||||
|
||||
let triggeringPrincipal = browserDragAndDrop.getTriggeringPrincipal(aEvent);
|
||||
let csp = browserDragAndDrop.getCSP(aEvent);
|
||||
let csp = browserDragAndDrop.getCsp(aEvent);
|
||||
for (let link of links) {
|
||||
if (link.url) {
|
||||
let data = await UrlbarUtils.getShortcutOrURIAndPostData(link.url);
|
||||
|
|
|
@ -817,7 +817,7 @@
|
|||
let replace = !!targetTab;
|
||||
let newIndex = this._getDropIndex(event, true);
|
||||
let urls = links.map(link => link.url);
|
||||
let csp = browserDragAndDrop.getCSP(event);
|
||||
let csp = browserDragAndDrop.getCsp(event);
|
||||
let triggeringPrincipal = browserDragAndDrop.getTriggeringPrincipal(
|
||||
event
|
||||
);
|
||||
|
|
|
@ -965,7 +965,7 @@ nsDocShellTreeOwner::HandleEvent(Event* aEvent) {
|
|||
LoadURIOptions loadURIOptions;
|
||||
loadURIOptions.mTriggeringPrincipal = triggeringPrincipal;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
handler->GetCSP(dragEvent, getter_AddRefs(csp));
|
||||
handler->GetCsp(dragEvent, getter_AddRefs(csp));
|
||||
loadURIOptions.mCsp = csp;
|
||||
webnav->LoadURI(url, loadURIOptions);
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ ContentAreaDropListener.prototype = {
|
|||
return this._getTriggeringPrincipalFromDataTransfer(dataTransfer, true);
|
||||
},
|
||||
|
||||
getCSP(aEvent) {
|
||||
getCsp(aEvent) {
|
||||
let sourceNode = aEvent.dataTransfer.mozSourceNode;
|
||||
if (aEvent.dataTransfer.mozCSP !== null) {
|
||||
return aEvent.dataTransfer.mozCSP;
|
||||
|
|
|
@ -3763,7 +3763,7 @@ nsresult Document::InitCSP(nsIChannel* aChannel) {
|
|||
mCSP->AppendPolicy(addonPolicy->ExtensionPageCSP(), false, false);
|
||||
// Bug 1548468: Move CSP off ExpandedPrincipal
|
||||
// Currently the LoadInfo holds the source of truth for every resource load
|
||||
// because LoadInfo::GetCSP() queries the CSP from an ExpandedPrincipal
|
||||
// because LoadInfo::GetCsp() queries the CSP from an ExpandedPrincipal
|
||||
// (and not from the Client) if the load was triggered by an extension.
|
||||
auto* basePrin = BasePrincipal::Cast(principal);
|
||||
if (basePrin->Is<ExpandedPrincipal>()) {
|
||||
|
|
|
@ -85,5 +85,5 @@ interface nsIDroppedLinkHandler : nsISupports
|
|||
/**
|
||||
* Given a drop event aEvent, determines the CSP for the event and returns it.
|
||||
*/
|
||||
nsIContentSecurityPolicy getCSP(in DragEvent aEvent);
|
||||
nsIContentSecurityPolicy getCsp(in DragEvent aEvent);
|
||||
};
|
||||
|
|
|
@ -83,7 +83,7 @@ class WorkerCSPCheckRunnable final : public WorkerMainThreadRunnable {
|
|||
|
||||
bool MainThreadRun() override {
|
||||
mResult = CheckInternal(
|
||||
mWorkerPrivate->GetCSP(), mWorkerPrivate->CSPEventListener(),
|
||||
mWorkerPrivate->GetCsp(), mWorkerPrivate->CSPEventListener(),
|
||||
mWorkerPrivate->GetLoadingPrincipal(), mExpression, mFileNameString,
|
||||
mLineNum, mColumnNum, &mEvalAllowed);
|
||||
return true;
|
||||
|
|
|
@ -166,7 +166,7 @@ bool subjectToCSP(nsIURI* aURI, nsContentPolicyType aContentType) {
|
|||
|
||||
// 2) Apply actual CSP to all loads. Please note that in case
|
||||
// the csp should be overruled (e.g. by an ExpandedPrincipal)
|
||||
// then loadinfo->GetCSP() returns that CSP instead of the
|
||||
// then loadinfo->GetCsp() returns that CSP instead of the
|
||||
// document's CSP.
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp = aLoadInfo->GetCsp();
|
||||
|
||||
|
|
|
@ -1963,7 +1963,7 @@ RuntimeService::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
bool LogViolationDetailsRunnable::MainThreadRun() {
|
||||
AssertIsOnMainThread();
|
||||
|
||||
nsIContentSecurityPolicy* csp = mWorkerPrivate->GetCSP();
|
||||
nsIContentSecurityPolicy* csp = mWorkerPrivate->GetCsp();
|
||||
if (csp) {
|
||||
csp->LogViolationDetails(mViolationType,
|
||||
nullptr, // triggering element
|
||||
|
|
|
@ -1387,7 +1387,7 @@ void WorkerPrivate::EvictFromBFCache() {
|
|||
runnable->Dispatch(this);
|
||||
}
|
||||
|
||||
void WorkerPrivate::SetCSP(nsIContentSecurityPolicy* aCSP) {
|
||||
void WorkerPrivate::SetCsp(nsIContentSecurityPolicy* aCSP) {
|
||||
AssertIsOnMainThread();
|
||||
if (!aCSP) {
|
||||
return;
|
||||
|
|
|
@ -793,12 +793,12 @@ class WorkerPrivate final
|
|||
|
||||
void EvictFromBFCache();
|
||||
|
||||
nsIContentSecurityPolicy* GetCSP() const {
|
||||
nsIContentSecurityPolicy* GetCsp() const {
|
||||
AssertIsOnMainThread();
|
||||
return mLoadInfo.mCSP;
|
||||
}
|
||||
|
||||
void SetCSP(nsIContentSecurityPolicy* aCSP);
|
||||
void SetCsp(nsIContentSecurityPolicy* aCSP);
|
||||
|
||||
nsresult SetCSPFromHeaderValues(const nsACString& aCSPHeaderValue,
|
||||
const nsACString& aCSPReportOnlyHeaderValue);
|
||||
|
|
|
@ -614,7 +614,7 @@ void CacheLoadHandler::DataReceived() {
|
|||
mWorkerRef->Private()->SetXHRParamsAllowed(parent->XHRParamsAllowed());
|
||||
|
||||
// Set Eval and ContentSecurityPolicy
|
||||
mWorkerRef->Private()->SetCSP(parent->GetCSP());
|
||||
mWorkerRef->Private()->SetCsp(parent->GetCsp());
|
||||
mWorkerRef->Private()->SetEvalAllowed(parent->IsEvalAllowed());
|
||||
mWorkerRef->Private()->SetWasmEvalAllowed(parent->IsWasmEvalAllowed());
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ nsresult NetworkLoadHandler::DataReceivedFromNetwork(nsIStreamLoader* aLoader,
|
|||
rv = mWorkerRef->Private()->SetPrincipalsAndCSPFromChannel(channel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp = mWorkerRef->Private()->GetCSP();
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp = mWorkerRef->Private()->GetCsp();
|
||||
// We did inherit CSP in bug 1223647. If we do not already have a CSP, we
|
||||
// should get it from the HTTP headers on the worker script.
|
||||
if (!csp) {
|
||||
|
|
|
@ -176,7 +176,7 @@ class LoadInfo final : public nsILoadInfo {
|
|||
// note that any additonal Meta CSP in that document will be merged
|
||||
// into that CSP. Any subresource loads within that document
|
||||
// subesquently will receive the correct CSP by querying
|
||||
// loadinfo->GetCSP() from that point on.
|
||||
// loadinfo->GetCsp() from that point on.
|
||||
void SetCSPToInherit(nsIContentSecurityPolicy* aCspToInherit) {
|
||||
mCspToInherit = aCspToInherit;
|
||||
}
|
||||
|
|
|
@ -1223,9 +1223,9 @@ interface nsILoadInfo : nsISupports
|
|||
* when fetching the resource this loadinfo belongs to.
|
||||
*
|
||||
* a) Non-navigations:
|
||||
* For non-navigation loads, GetCSP() returns what the spec refers to as the
|
||||
* For non-navigation loads, GetCsp() returns what the spec refers to as the
|
||||
* "request's client's global object's CSP list". In practice, if this is the
|
||||
* loadinfo of a subresource load (e.g an image load), then GetCSP() or
|
||||
* loadinfo of a subresource load (e.g an image load), then GetCsp() or
|
||||
* GetPreloadCSP() returns the CSP of the document which embeds the image.
|
||||
* The returned CSP includes any policy delivered through the HTTP header or
|
||||
* also through the meta tag (modulo the difference for preloads, e.g. image
|
||||
|
@ -1236,7 +1236,7 @@ interface nsILoadInfo : nsISupports
|
|||
*
|
||||
* b) Navigations:
|
||||
* * Top-level loads:
|
||||
* For top-level loads (navigations) GetCSP() will return null, unless
|
||||
* For top-level loads (navigations) GetCsp() will return null, unless
|
||||
* the navigation is started by a WebExtension, in which case it will
|
||||
* return the CSP of the webextension, if any.
|
||||
* If you need to query the CSP that potentially should apply to the
|
||||
|
@ -1245,7 +1245,7 @@ interface nsILoadInfo : nsISupports
|
|||
* is for non-navigation requests.
|
||||
*
|
||||
* * Iframe-loads:
|
||||
* For iframe-loads (navigations) GetCSP() will return the CSP of the
|
||||
* For iframe-loads (navigations) GetCsp() will return the CSP of the
|
||||
* parent document, unless the navigation is started by a WebExtension,
|
||||
* in which case it will return the CSP of the webextension, if any.
|
||||
*
|
||||
|
|
|
@ -122,11 +122,11 @@ async function testPolicy({
|
|||
browser.runtime.getURL("").replace(/\/$/, "")
|
||||
);
|
||||
|
||||
browser.test.sendMessage("background-csp", window.getCSP());
|
||||
browser.test.sendMessage("background-csp", window.getCsp());
|
||||
}
|
||||
|
||||
function tabScript() {
|
||||
browser.test.sendMessage("tab-csp", window.getCSP());
|
||||
browser.test.sendMessage("tab-csp", window.getCsp());
|
||||
|
||||
const worker = new Worker("worker.js");
|
||||
worker.onmessage = event => {
|
||||
|
@ -208,11 +208,11 @@ async function testPolicy({
|
|||
"DOMWindowCreated",
|
||||
event => {
|
||||
let win = event.target.ownerGlobal;
|
||||
function getCSP() {
|
||||
function getCsp() {
|
||||
let { cspJSON } = win.document;
|
||||
return win.wrappedJSObject.JSON.parse(cspJSON);
|
||||
}
|
||||
Cu.exportFunction(getCSP, win, { defineAs: "getCSP" });
|
||||
Cu.exportFunction(getCsp, win, { defineAs: "getCsp" });
|
||||
},
|
||||
true
|
||||
);
|
||||
|
@ -248,7 +248,7 @@ async function testPolicy({
|
|||
frame.onload = resolve;
|
||||
});
|
||||
|
||||
return frame.contentWindow.wrappedJSObject.getCSP();
|
||||
return frame.contentWindow.wrappedJSObject.getCsp();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче