summaryrefslogtreecommitdiffstats
path: root/dom/base/nsPluginArray.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-02-22 11:47:32 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-22 11:47:32 +0100
commit7b7ea5c59a6f282be1d02a199f46483447ec00c1 (patch)
tree8687a74d52001a48b616a8fc30e3ada54d19cb0c /dom/base/nsPluginArray.cpp
parentb7274fd666e1bb33effc1425701f566bcaa6f7be (diff)
parentcff4a7d0b65b9cfe272d72f7a26e3dcc33ea0a03 (diff)
downloadUXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.tar
UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.tar.gz
UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.tar.lz
UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.tar.xz
UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.zip
Merge branch 'ported-moebius'
Diffstat (limited to 'dom/base/nsPluginArray.cpp')
-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 b9c946ca3..5b9378ae0 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);
+ }
}
}
}