mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Make Event's isTrusted attribute unforgeable
This commit is contained in:
parent
e493a0655e
commit
f244a7075c
13 changed files with 63 additions and 8 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
use dom::bindings::codegen::Bindings::CloseEventBinding;
|
use dom::bindings::codegen::Bindings::CloseEventBinding;
|
||||||
use dom::bindings::codegen::Bindings::CloseEventBinding::CloseEventMethods;
|
use dom::bindings::codegen::Bindings::CloseEventBinding::CloseEventMethods;
|
||||||
|
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
|
@ -90,4 +91,9 @@ impl CloseEventMethods for CloseEvent {
|
||||||
fn Reason(&self) -> DOMString {
|
fn Reason(&self) -> DOMString {
|
||||||
self.reason.clone()
|
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;
|
||||||
use dom::bindings::codegen::Bindings::CustomEventBinding::CustomEventMethods;
|
use dom::bindings::codegen::Bindings::CustomEventBinding::CustomEventMethods;
|
||||||
|
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
|
@ -89,4 +90,9 @@ impl CustomEventMethods for CustomEvent {
|
||||||
detail: HandleValue) {
|
detail: HandleValue) {
|
||||||
self.init_custom_event(_cx, Atom::from(&*type_), can_bubble, cancelable, detail)
|
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::cell::DOMRefCell;
|
||||||
use dom::bindings::codegen::Bindings::ErrorEventBinding;
|
use dom::bindings::codegen::Bindings::ErrorEventBinding;
|
||||||
use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods;
|
use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods;
|
||||||
|
use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
|
@ -134,4 +135,8 @@ impl ErrorEventMethods for ErrorEvent {
|
||||||
self.error.get()
|
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 {
|
fn Which(&self) -> u32 {
|
||||||
self.char_code.get().unwrap_or(self.KeyCode())
|
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
|
* 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/. */
|
* 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;
|
||||||
use dom::bindings::codegen::Bindings::MessageEventBinding::MessageEventMethods;
|
use dom::bindings::codegen::Bindings::MessageEventBinding::MessageEventMethods;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
|
@ -99,4 +100,9 @@ impl MessageEventMethods for MessageEvent {
|
||||||
fn LastEventId(&self) -> DOMString {
|
fn LastEventId(&self) -> DOMString {
|
||||||
self.lastEventId.clone()
|
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.button.set(buttonArg);
|
||||||
self.related_target.set(relatedTargetArg);
|
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
|
* 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/. */
|
* 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;
|
||||||
use dom::bindings::codegen::Bindings::ProgressEventBinding::ProgressEventMethods;
|
use dom::bindings::codegen::Bindings::ProgressEventBinding::ProgressEventMethods;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
|
@ -70,4 +71,9 @@ impl ProgressEventMethods for ProgressEvent {
|
||||||
fn Total(&self) -> u64 {
|
fn Total(&self) -> u64 {
|
||||||
self.total
|
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
|
* 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/. */
|
* 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;
|
||||||
use dom::bindings::codegen::Bindings::StorageEventBinding::{StorageEventMethods};
|
use dom::bindings::codegen::Bindings::StorageEventBinding::{StorageEventMethods};
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
|
@ -108,4 +109,9 @@ impl StorageEventMethods for StorageEvent {
|
||||||
fn GetStorageArea(&self) -> Option<Root<Storage>> {
|
fn GetStorageArea(&self) -> Option<Root<Storage>> {
|
||||||
self.storageArea.get()
|
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> {
|
fn ChangedTouches(&self) -> Root<TouchList> {
|
||||||
self.changed_touches.get()
|
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
|
* 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/. */
|
* 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;
|
||||||
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
use dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
|
@ -95,4 +96,9 @@ impl UIEventMethods for UIEvent {
|
||||||
self.view.set(view);
|
self.view.set(view);
|
||||||
self.detail.set(detail);
|
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
|
* 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/. */
|
* 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;
|
||||||
use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventInit;
|
use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventInit;
|
||||||
use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventMethods;
|
use dom::bindings::codegen::Bindings::WebGLContextEventBinding::WebGLContextEventMethods;
|
||||||
|
@ -25,6 +26,11 @@ impl WebGLContextEventMethods for WebGLContextEvent {
|
||||||
fn StatusMessage(&self) -> DOMString {
|
fn StatusMessage(&self) -> DOMString {
|
||||||
self.status_message.clone()
|
self.status_message.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#dom-event-istrusted
|
||||||
|
fn IsTrusted(&self) -> bool {
|
||||||
|
self.event.IsTrusted()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WebGLContextEvent {
|
impl WebGLContextEvent {
|
||||||
|
|
|
@ -34,6 +34,7 @@ interface Event {
|
||||||
[Pure]
|
[Pure]
|
||||||
readonly attribute boolean defaultPrevented;
|
readonly attribute boolean defaultPrevented;
|
||||||
|
|
||||||
|
[Unforgeable]
|
||||||
readonly attribute boolean isTrusted;
|
readonly attribute boolean isTrusted;
|
||||||
[Constant]
|
[Constant]
|
||||||
readonly attribute DOMTimeStamp timeStamp;
|
readonly attribute DOMTimeStamp timeStamp;
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
[interfaces.html]
|
[interfaces.html]
|
||||||
type: testharness
|
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]
|
[CustomEvent interface: existence and properties of interface object]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Event interface: new CustomEvent("foo") must have own property "isTrusted"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[MutationObserver interface: existence and properties of interface object]
|
[MutationObserver interface: existence and properties of interface object]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue