diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-05-27 19:19:27 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-05-27 19:19:27 +0200 |
commit | fb1b45e5fcb82e76e303665fbb9d04fb2a800b31 (patch) | |
tree | 97baa867e3534b1bd5153067d2bd853462a4b12b /dom/canvas/CanvasUtils.cpp | |
parent | 47c52f2dc2cc4eb4f5582a7ca50b682548b1708c (diff) | |
download | uxp-fb1b45e5fcb82e76e303665fbb9d04fb2a800b31.tar.gz |
Improve origin-clean algorithm
Diffstat (limited to 'dom/canvas/CanvasUtils.cpp')
-rw-r--r-- | dom/canvas/CanvasUtils.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/dom/canvas/CanvasUtils.cpp b/dom/canvas/CanvasUtils.cpp index c7cfed83f6..6c9addf596 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 |