Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Event's isTrusted attribute unforgeable #8963

Merged
merged 1 commit into from Dec 14, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -4,6 +4,7 @@

use dom::bindings::codegen::Bindings::CloseEventBinding;
use dom::bindings::codegen::Bindings::CloseEventBinding::CloseEventMethods;
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
@@ -90,4 +91,9 @@ impl CloseEventMethods for CloseEvent {
fn Reason(&self) -> DOMString {
self.reason.clone()
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
@@ -4,6 +4,7 @@

use dom::bindings::codegen::Bindings::CustomEventBinding;
use dom::bindings::codegen::Bindings::CustomEventBinding::CustomEventMethods;
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
@@ -89,4 +90,9 @@ impl CustomEventMethods for CustomEvent {
detail: HandleValue) {
self.init_custom_event(_cx, Atom::from(&*type_), can_bubble, cancelable, detail)
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
@@ -5,6 +5,7 @@
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::ErrorEventBinding;
use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods;
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
@@ -134,4 +135,8 @@ impl ErrorEventMethods for ErrorEvent {
self.error.get()
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
@@ -841,4 +841,9 @@ impl KeyboardEventMethods for KeyboardEvent {
fn Which(&self) -> u32 {
self.char_code.get().unwrap_or(self.KeyCode())
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.uievent.IsTrusted()
}
}
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::MessageEventBinding;
use dom::bindings::codegen::Bindings::MessageEventBinding::MessageEventMethods;
use dom::bindings::error::Fallible;
@@ -99,4 +100,9 @@ impl MessageEventMethods for MessageEvent {
fn LastEventId(&self) -> DOMString {
self.lastEventId.clone()
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
@@ -206,4 +206,9 @@ impl MouseEventMethods for MouseEvent {
self.button.set(buttonArg);
self.related_target.set(relatedTargetArg);
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.uievent.IsTrusted()
}
}
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::ProgressEventBinding;
use dom::bindings::codegen::Bindings::ProgressEventBinding::ProgressEventMethods;
use dom::bindings::error::Fallible;
@@ -70,4 +71,9 @@ impl ProgressEventMethods for ProgressEvent {
fn Total(&self) -> u64 {
self.total
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::StorageEventBinding;
use dom::bindings::codegen::Bindings::StorageEventBinding::{StorageEventMethods};
use dom::bindings::error::Fallible;
@@ -108,4 +109,9 @@ impl StorageEventMethods for StorageEvent {
fn GetStorageArea(&self) -> Option<Root<Storage>> {
self.storageArea.get()
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
@@ -114,4 +114,9 @@ impl<'a> TouchEventMethods for &'a TouchEvent {
fn ChangedTouches(&self) -> Root<TouchList> {
self.changed_touches.get()
}

/// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.uievent.IsTrusted()
}
}
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::UIEventBinding;
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
use dom::bindings::error::Fallible;
@@ -95,4 +96,9 @@ impl UIEventMethods for UIEvent {
self.view.set(view);
self.detail.set(detail);
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::codegen::Bindings::WebGLContextEventBinding;
use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventInit;
use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventMethods;
@@ -25,6 +26,11 @@ impl WebGLContextEventMethods for WebGLContextEvent {
fn StatusMessage(&self) -> DOMString {
self.status_message.clone()
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
}

impl WebGLContextEvent {
@@ -34,6 +34,7 @@ interface Event {
[Pure]
readonly attribute boolean defaultPrevented;

[Unforgeable]
readonly attribute boolean isTrusted;
[Constant]
readonly attribute DOMTimeStamp timeStamp;
@@ -1,17 +1,9 @@
[interfaces.html]
type: testharness
[Event interface: document.createEvent("Event") must have own property "isTrusted"]
expected: FAIL

[Event interface: new Event("foo") must have own property "isTrusted"]
expected: FAIL

[CustomEvent interface: existence and properties of interface object]
expected: FAIL

[Event interface: new CustomEvent("foo") must have own property "isTrusted"]
expected: FAIL

[MutationObserver interface: existence and properties of interface object]
expected: FAIL

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.