summaryrefslogtreecommitdiffstats
path: root/dom/canvas/CanvasUtils.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-06-04 18:21:04 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-06-04 18:21:04 +0200
commitdee00a8a79394559e0e868cc72464c2de24583ac (patch)
tree18dc2e3db8127ceabcf9b03416b135bced2976ad /dom/canvas/CanvasUtils.cpp
parent851cfd198bc01020cd411d4f1cd6586222700269 (diff)
parent363bfeb2c06e5f57136ebdab8da1ebeba0591520 (diff)
downloadUXP-dee00a8a79394559e0e868cc72464c2de24583ac.tar
UXP-dee00a8a79394559e0e868cc72464c2de24583ac.tar.gz
UXP-dee00a8a79394559e0e868cc72464c2de24583ac.tar.lz
UXP-dee00a8a79394559e0e868cc72464c2de24583ac.tar.xz
UXP-dee00a8a79394559e0e868cc72464c2de24583ac.zip
Merge branch 'master' into Basilisk-release
Diffstat (limited to 'dom/canvas/CanvasUtils.cpp')
-rw-r--r--dom/canvas/CanvasUtils.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/dom/canvas/CanvasUtils.cpp b/dom/canvas/CanvasUtils.cpp
index c7cfed83f..6c9addf59 100644
--- a/dom/canvas/CanvasUtils.cpp
+++ b/dom/canvas/CanvasUtils.cpp
@@ -126,5 +126,25 @@ CoerceDouble(const JS::Value& v, double* d)
return true;
}
+bool CheckWriteOnlySecurity(bool aCORSUsed, nsIPrincipal* aPrincipal) {
+ if (!aPrincipal) {
+ return true;
+ }
+
+ if (!aCORSUsed) {
+ nsIGlobalObject* incumbentSettingsObject = dom::GetIncumbentGlobal();
+ if (NS_WARN_IF(!incumbentSettingsObject)) {
+ return true;
+ }
+
+ nsIPrincipal* principal = incumbentSettingsObject->PrincipalOrNull();
+ if (NS_WARN_IF(!principal) || !(principal->Subsumes(aPrincipal))) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
} // namespace CanvasUtils
} // namespace mozilla