aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-05-30 04:28:39 -0500
committerbors-servo <lbergstrom+bors@mozilla.com>2016-05-30 04:28:39 -0500
commit0ec30a6127432e22c56c2ee73c28479481e3cffc (patch)
tree25509c6642de260e25dd37e02ecb53e86f5bf048 /components
parentb11648903bb07a31ec93f3030058ed41b3472b17 (diff)
parent704646698f685626dbf8448b067306db37883991 (diff)
downloadservo-0ec30a6127432e22c56c2ee73c28479481e3cffc.tar.gz
servo-0ec30a6127432e22c56c2ee73c28479481e3cffc.zip
Auto merge of #11508 - nox:mozbrowser, r=Ms2ger
Fix permissions of mozbrowser and BrowserElementPrivileged (fixes #11498) <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11508) <!-- Reviewable:end -->
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/htmliframeelement.rs8
-rw-r--r--components/script/dom/webidls/BrowserElement.webidl8
-rw-r--r--components/script/dom/window.rs10
3 files changed, 16 insertions, 10 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index a4d1958445b..552730a2bb3 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -437,8 +437,12 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
// https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser
fn Mozbrowser(&self) -> bool {
- let element = self.upcast::<Element>();
- element.has_attribute(&atom!("mozbrowser"))
+ if window_from_node(self).is_mozbrowser() {
+ let element = self.upcast::<Element>();
+ element.has_attribute(&atom!("mozbrowser"))
+ } else {
+ false
+ }
}
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser
diff --git a/components/script/dom/webidls/BrowserElement.webidl b/components/script/dom/webidls/BrowserElement.webidl
index 9bb34b90a95..2767fa15071 100644
--- a/components/script/dom/webidls/BrowserElement.webidl
+++ b/components/script/dom/webidls/BrowserElement.webidl
@@ -146,16 +146,16 @@ interface BrowserElementPrivileged {
// unsigned long count,
// unsigned long modifiers);
- [Throws]
+ [Func="Window::global_is_mozbrowser", Throws]
void goBack();
- [Throws]
+ [Func="Window::global_is_mozbrowser", Throws]
void goForward();
- [Throws]
+ [Func="Window::global_is_mozbrowser", Throws]
void reload(optional boolean hardReload = false);
- [Throws]
+ [Func="Window::global_is_mozbrowser", Throws]
void stop();
//[Throws,
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 0f21139c324..4862cb83c9e 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -1459,15 +1459,17 @@ impl Window {
})
}
+ /// Returns whether this window is mozbrowser.
+ pub fn is_mozbrowser(&self) -> bool {
+ mozbrowser_enabled() && self.parent_info().is_none()
+ }
+
/// Returns whether mozbrowser is enabled and `obj` has been created
/// in a top-level `Window` global.
#[allow(unsafe_code)]
pub unsafe fn global_is_mozbrowser(_: *mut JSContext, obj: HandleObject) -> bool {
- if !mozbrowser_enabled() {
- return false;
- }
match global_root_from_object(obj.get()).r() {
- GlobalRef::Window(window) => window.parent_info().is_none(),
+ GlobalRef::Window(window) => window.is_mozbrowser(),
_ => false,
}
}