summaryrefslogtreecommitdiffstats
path: root/dom/canvas/CanvasUtils.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-05-27 19:19:27 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-05-28 18:19:59 +0200
commite69b3f567c4b8957cc09ba4359e84939f77781c5 (patch)
treefb7fda7196c860870510dccc421cc1224db08352 /dom/canvas/CanvasUtils.cpp
parentbce405101e67cbcae222fbc5e96d682aff981372 (diff)
downloadUXP-e69b3f567c4b8957cc09ba4359e84939f77781c5.tar
UXP-e69b3f567c4b8957cc09ba4359e84939f77781c5.tar.gz
UXP-e69b3f567c4b8957cc09ba4359e84939f77781c5.tar.lz
UXP-e69b3f567c4b8957cc09ba4359e84939f77781c5.tar.xz
UXP-e69b3f567c4b8957cc09ba4359e84939f77781c5.zip
Improve origin-clean algorithm
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