summaryrefslogtreecommitdiff
path: root/dom/base
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2017-08-27 10:17:36 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-02-22 11:37:32 +0100
commit143331f2a45eff3f48e7e69ab4cf70986d29ef34 (patch)
tree68a4b7eb1ec3a1fda2a6a5a58e198412a8e8b642 /dom/base
parentfecca76b8391dc5e4875577f986f105593b2e34f (diff)
downloaduxp-143331f2a45eff3f48e7e69ab4cf70986d29ef34.tar.gz
Propagate plugin permissions from top-level to XO iframes.
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/nsPluginArray.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/dom/base/nsPluginArray.cpp b/dom/base/nsPluginArray.cpp
index b9c946ca36..5b9378ae08 100644
--- a/dom/base/nsPluginArray.cpp
+++ b/dom/base/nsPluginArray.cpp
@@ -372,9 +372,21 @@ nsPluginArray::EnsurePlugins()
nsCString permString;
nsresult rv = pluginHost->GetPermissionStringForTag(pluginTag, 0, permString);
if (rv == NS_OK) {
- nsIPrincipal* principal = mWindow->GetExtantDoc()->NodePrincipal();
- nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
- permMgr->TestPermissionFromPrincipal(principal, permString.get(), &permission);
+ nsCOMPtr<nsIDocument> currentDoc = mWindow->GetExtantDoc();
+
+ // The top-level content document gets the final say on whether or not
+ // a plugin is going to be hidden or not, regardless of the origin
+ // that a subframe is hosted at. This is to avoid spamming the user
+ // with the hidden plugin notification bar when third-party iframes
+ // attempt to access navigator.plugins after the user has already
+ // expressed that the top-level document has this permission.
+ nsCOMPtr<nsIDocument> topDoc = currentDoc->GetTopLevelContentDocument();
+
+ if (topDoc) {
+ nsIPrincipal* principal = topDoc->NodePrincipal();
+ nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
+ permMgr->TestPermissionFromPrincipal(principal, permString.get(), &permission);
+ }
}
}
}