aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/script/dom/blob.rs22
-rw-r--r--src/components/script/dom/location.rs116
-rw-r--r--src/components/script/dom/mouseevent.rs32
-rw-r--r--src/components/script/dom/navigator.rs68
-rw-r--r--src/components/script/dom/uievent.rs60
-rw-r--r--src/components/script/dom/validitystate.rs47
-rw-r--r--src/components/script/dom/webidls/Blob.webidl39
-rw-r--r--src/components/script/dom/webidls/Location.webidl23
-rw-r--r--src/components/script/dom/webidls/MouseEvent.webidl98
-rw-r--r--src/components/script/dom/webidls/Navigator.webidl79
-rw-r--r--src/components/script/dom/webidls/UIEvent.webidl48
-rw-r--r--src/components/script/dom/webidls/URLUtils.webidl41
-rw-r--r--src/components/script/dom/webidls/ValidityState.webidl34
-rw-r--r--src/components/script/dom/webidls/Window.webidl123
-rw-r--r--src/components/script/dom/window.rs62
-rw-r--r--src/test/content/test_MouseEvent.html1
-rw-r--r--src/test/content/test_navigator.html9
17 files changed, 192 insertions, 710 deletions
diff --git a/src/components/script/dom/blob.rs b/src/components/script/dom/blob.rs
index 162a859acb1..f98021eac7a 100644
--- a/src/components/script/dom/blob.rs
+++ b/src/components/script/dom/blob.rs
@@ -7,7 +7,6 @@ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::Fallible;
use dom::bindings::codegen::BindingDeclarations::BlobBinding;
use dom::window::Window;
-use servo_util::str::DOMString;
#[deriving(Encodable)]
pub struct Blob {
@@ -35,27 +34,6 @@ impl Blob {
}
pub trait BlobMethods {
- fn Size(&self) -> u64;
- fn Type(&self) -> DOMString;
- fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Temporary<Blob>;
- fn Close(&self);
-}
-
-impl<'a> BlobMethods for JSRef<'a, Blob> {
- fn Size(&self) -> u64 {
- 0
- }
-
- fn Type(&self) -> DOMString {
- "".to_owned()
- }
-
- fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Temporary<Blob> {
- let window = self.window.root();
- Blob::new(&window.root_ref())
- }
-
- fn Close(&self) {}
}
impl Reflectable for Blob {
diff --git a/src/components/script/dom/location.rs b/src/components/script/dom/location.rs
index 2e346effb12..051410815ca 100644
--- a/src/components/script/dom/location.rs
+++ b/src/components/script/dom/location.rs
@@ -5,7 +5,6 @@
use dom::bindings::codegen::BindingDeclarations::LocationBinding;
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
-use dom::bindings::error::Fallible;
use dom::window::Window;
use servo_util::str::DOMString;
@@ -37,128 +36,13 @@ impl Location {
}
pub trait LocationMethods {
- fn Assign(&self, _url: DOMString);
- fn Replace(&self, _url: DOMString);
- fn Reload(&self);
fn Href(&self) -> DOMString;
- fn SetHref(&self, _href: DOMString) -> Fallible<()>;
- fn Origin(&self) -> DOMString;
- fn Protocol(&self) -> DOMString;
- fn SetProtocol(&self, _protocol: DOMString);
- fn Username(&self) -> DOMString;
- fn SetUsername(&self, _username: DOMString);
- fn Password(&self) -> DOMString;
- fn SetPassword(&self, _password: DOMString);
- fn Host(&self) -> DOMString;
- fn SetHost(&self, _host: DOMString);
- fn Hostname(&self) -> DOMString;
- fn SetHostname(&self, _hostname: DOMString);
- fn Port(&self) -> DOMString;
- fn SetPort(&self, _port: DOMString);
- fn Pathname(&self) -> DOMString;
- fn SetPathname(&self, _pathname: DOMString);
- fn Search(&self) -> DOMString;
- fn SetSearch(&self, _search: DOMString);
- fn Hash(&self) -> DOMString;
- fn SetHash(&self, _hash: DOMString);
}
impl<'a> LocationMethods for JSRef<'a, Location> {
- fn Assign(&self, _url: DOMString) {
-
- }
-
- fn Replace(&self, _url: DOMString) {
-
- }
-
- fn Reload(&self) {
-
- }
-
fn Href(&self) -> DOMString {
self.page.get_url().to_str()
}
-
- fn SetHref(&self, _href: DOMString) -> Fallible<()> {
- Ok(())
- }
-
- fn Origin(&self) -> DOMString {
- "".to_owned()
- }
-
- fn Protocol(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetProtocol(&self, _protocol: DOMString) {
-
- }
-
- fn Username(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetUsername(&self, _username: DOMString) {
-
- }
-
- fn Password(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetPassword(&self, _password: DOMString) {
-
- }
-
- fn Host(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetHost(&self, _host: DOMString) {
-
- }
-
- fn Hostname(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetHostname(&self, _hostname: DOMString) {
-
- }
-
- fn Port(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetPort(&self, _port: DOMString) {
-
- }
-
- fn Pathname(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetPathname(&self, _pathname: DOMString) {
-
- }
-
- fn Search(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetSearch(&self, _search: DOMString) {
-
- }
-
- fn Hash(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetHash(&self, _hash: DOMString) {
-
- }
}
impl Reflectable for Location {
diff --git a/src/components/script/dom/mouseevent.rs b/src/components/script/dom/mouseevent.rs
index 55326b8afcd..d27c89ffb4d 100644
--- a/src/components/script/dom/mouseevent.rs
+++ b/src/components/script/dom/mouseevent.rs
@@ -25,7 +25,7 @@ pub struct MouseEvent {
pub shift_key: bool,
pub alt_key: bool,
pub meta_key: bool,
- pub button: u16,
+ pub button: i16,
pub related_target: Cell<Option<JS<EventTarget>>>
}
@@ -72,7 +72,7 @@ impl MouseEvent {
altKey: bool,
shiftKey: bool,
metaKey: bool,
- button: u16,
+ button: i16,
relatedTarget: Option<JSRef<EventTarget>>) -> Temporary<MouseEvent> {
let mut ev = MouseEvent::new_uninitialized(window).root();
ev.InitMouseEvent(type_, canBubble, cancelable, view, detail,
@@ -85,9 +85,11 @@ impl MouseEvent {
pub fn Constructor(owner: &JSRef<Window>,
type_: DOMString,
init: &MouseEventBinding::MouseEventInit) -> Fallible<Temporary<MouseEvent>> {
- let event = MouseEvent::new(owner, type_, init.bubbles, init.cancelable,
- init.view.root_ref(),
- init.detail, init.screenX, init.screenY,
+ let event = MouseEvent::new(owner, type_, init.parent.parent.bubbles,
+ init.parent.parent.cancelable,
+ init.parent.view.root_ref(),
+ init.parent.detail,
+ init.screenX, init.screenY,
init.clientX, init.clientY, init.ctrlKey,
init.altKey, init.shiftKey, init.metaKey,
init.button, init.relatedTarget.root_ref());
@@ -104,10 +106,8 @@ pub trait MouseEventMethods {
fn ShiftKey(&self) -> bool;
fn AltKey(&self) -> bool;
fn MetaKey(&self) -> bool;
- fn Button(&self) -> u16;
- fn Buttons(&self)-> u16;
+ fn Button(&self) -> i16;
fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>>;
- fn GetModifierState(&self, _keyArg: DOMString) -> bool;
fn InitMouseEvent(&mut self,
typeArg: DOMString,
canBubbleArg: bool,
@@ -122,7 +122,7 @@ pub trait MouseEventMethods {
altKeyArg: bool,
shiftKeyArg: bool,
metaKeyArg: bool,
- buttonArg: u16,
+ buttonArg: i16,
relatedTargetArg: Option<JSRef<EventTarget>>);
}
@@ -159,24 +159,14 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
self.meta_key
}
- fn Button(&self) -> u16 {
+ fn Button(&self) -> i16 {
self.button
}
- fn Buttons(&self)-> u16 {
- //TODO
- 0
- }
-
fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>> {
self.related_target.get().clone().map(|target| Temporary::new(target))
}
- fn GetModifierState(&self, _keyArg: DOMString) -> bool {
- //TODO
- false
- }
-
fn InitMouseEvent(&mut self,
typeArg: DOMString,
canBubbleArg: bool,
@@ -191,7 +181,7 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
altKeyArg: bool,
shiftKeyArg: bool,
metaKeyArg: bool,
- buttonArg: u16,
+ buttonArg: i16,
relatedTargetArg: Option<JSRef<EventTarget>>) {
{
let uievent: &mut JSRef<UIEvent> = UIEventCast::from_mut_ref(self);
diff --git a/src/components/script/dom/navigator.rs b/src/components/script/dom/navigator.rs
index a50967a25c1..cf66e51d57d 100644
--- a/src/components/script/dom/navigator.rs
+++ b/src/components/script/dom/navigator.rs
@@ -5,7 +5,6 @@
use dom::bindings::codegen::BindingDeclarations::NavigatorBinding;
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
-use dom::bindings::error::Fallible;
use dom::window::Window;
use servo_util::str::DOMString;
@@ -29,57 +28,18 @@ impl Navigator {
}
pub trait NavigatorMethods {
- fn DoNotTrack(&self) -> DOMString;
- fn Vendor(&self) -> DOMString;
- fn VendorSub(&self) -> DOMString;
fn Product(&self) -> DOMString;
- fn ProductSub(&self) -> DOMString;
- fn CookieEnabled(&self) -> bool;
- fn GetBuildID(&self) -> Fallible<DOMString>;
- fn JavaEnabled(&self) -> Fallible<bool>;
fn TaintEnabled(&self) -> bool;
fn AppName(&self) -> DOMString;
- fn GetAppCodeName(&self) -> Fallible<DOMString>;
- fn GetAppVersion(&self) -> Fallible<DOMString>;
- fn GetPlatform(&self) -> Fallible<DOMString>;
- fn GetUserAgent(&self) -> Fallible<DOMString>;
- fn GetLanguage(&self) -> Option<DOMString>;
- fn OnLine(&self) -> bool;
+ fn AppCodeName(&self) -> DOMString;
+ fn Platform(&self) -> DOMString;
}
impl<'a> NavigatorMethods for JSRef<'a, Navigator> {
- fn DoNotTrack(&self) -> DOMString {
- "unspecified".to_owned()
- }
-
- fn Vendor(&self) -> DOMString {
- "".to_owned() // Like Gecko
- }
-
- fn VendorSub(&self) -> DOMString {
- "".to_owned() // Like Gecko
- }
-
fn Product(&self) -> DOMString {
"Gecko".to_owned()
}
- fn ProductSub(&self) -> DOMString {
- "".to_owned()
- }
-
- fn CookieEnabled(&self) -> bool {
- false
- }
-
- fn GetBuildID(&self) -> Fallible<DOMString> {
- Ok("".to_owned())
- }
-
- fn JavaEnabled(&self) -> Fallible<bool> {
- Ok(false)
- }
-
fn TaintEnabled(&self) -> bool {
false
}
@@ -88,28 +48,12 @@ impl<'a> NavigatorMethods for JSRef<'a, Navigator> {
"Netscape".to_owned() // Like Gecko/Webkit
}
- fn GetAppCodeName(&self) -> Fallible<DOMString> {
- Ok("Mozilla".to_owned()) // Like Gecko/Webkit
- }
-
- fn GetAppVersion(&self) -> Fallible<DOMString> {
- Ok("".to_owned())
- }
-
- fn GetPlatform(&self) -> Fallible<DOMString> {
- Ok("".to_owned())
- }
-
- fn GetUserAgent(&self) -> Fallible<DOMString> {
- Ok("".to_owned())
+ fn AppCodeName(&self) -> DOMString {
+ "Mozilla".to_owned()
}
- fn GetLanguage(&self) -> Option<DOMString> {
- None
- }
-
- fn OnLine(&self) -> bool {
- true
+ fn Platform(&self) -> DOMString {
+ "".to_owned()
}
}
diff --git a/src/components/script/dom/uievent.rs b/src/components/script/dom/uievent.rs
index 4cbad225ef3..c1b5ef731ab 100644
--- a/src/components/script/dom/uievent.rs
+++ b/src/components/script/dom/uievent.rs
@@ -8,7 +8,6 @@ use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, OptionalSettable}
use dom::bindings::error::Fallible;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, EventMethods, EventTypeId, UIEventTypeId};
-use dom::node::Node;
use dom::window::Window;
use servo_util::str::DOMString;
@@ -67,16 +66,6 @@ impl UIEvent {
pub trait UIEventMethods {
fn GetView(&self) -> Option<Temporary<Window>>;
fn Detail(&self) -> i32;
- fn LayerX(&self) -> i32;
- fn LayerY(&self) -> i32;
- fn PageX(&self) -> i32;
- fn PageY(&self) -> i32;
- fn Which(&self) -> u32;
- fn GetRangeParent(&self) -> Option<Temporary<Node>>;
- fn RangeOffset(&self) -> i32;
- fn CancelBubble(&self) -> bool;
- fn SetCancelBubble(&self, _val: bool);
- fn IsChar(&self) -> bool;
fn InitUIEvent(&mut self,
type_: DOMString,
can_bubble: bool,
@@ -107,55 +96,6 @@ impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
self.view.assign(view);
self.detail = detail;
}
-
- fn LayerX(&self) -> i32 {
- //TODO
- 0
- }
-
- fn LayerY(&self) -> i32 {
- //TODO
- 0
- }
-
- fn PageX(&self) -> i32 {
- //TODO
- 0
- }
-
- fn PageY(&self) -> i32 {
- //TODO
- 0
- }
-
- fn Which(&self) -> u32 {
- //TODO
- 0
- }
-
- fn GetRangeParent(&self) -> Option<Temporary<Node>> {
- //TODO
- None
- }
-
- fn RangeOffset(&self) -> i32 {
- //TODO
- 0
- }
-
- fn CancelBubble(&self) -> bool {
- //TODO
- false
- }
-
- fn SetCancelBubble(&self, _val: bool) {
- //TODO
- }
-
- fn IsChar(&self) -> bool {
- //TODO
- false
- }
}
impl Reflectable for UIEvent {
diff --git a/src/components/script/dom/validitystate.rs b/src/components/script/dom/validitystate.rs
index f4c4aa114cf..25b89cd4bfc 100644
--- a/src/components/script/dom/validitystate.rs
+++ b/src/components/script/dom/validitystate.rs
@@ -32,53 +32,6 @@ impl ValidityState {
}
pub trait ValidityStateMethods {
- fn ValueMissing(&self) -> bool;
- fn TypeMismatch(&self) -> bool;
- fn PatternMismatch(&self) -> bool;
- fn TooLong(&self) -> bool;
- fn RangeUnderflow(&self) -> bool;
- fn RangeOverflow(&self) -> bool;
- fn StepMismatch(&self) -> bool;
- fn CustomError(&self) -> bool;
- fn Valid(&self) -> bool;
-}
-
-impl<'a> ValidityStateMethods for JSRef<'a, ValidityState> {
- fn ValueMissing(&self) -> bool {
- false
- }
-
- fn TypeMismatch(&self) -> bool {
- false
- }
-
- fn PatternMismatch(&self) -> bool {
- false
- }
-
- fn TooLong(&self) -> bool {
- false
- }
-
- fn RangeUnderflow(&self) -> bool {
- false
- }
-
- fn RangeOverflow(&self) -> bool {
- false
- }
-
- fn StepMismatch(&self) -> bool {
- false
- }
-
- fn CustomError(&self) -> bool {
- false
- }
-
- fn Valid(&self) -> bool {
- true
- }
}
impl Reflectable for ValidityState {
diff --git a/src/components/script/dom/webidls/Blob.webidl b/src/components/script/dom/webidls/Blob.webidl
index 8fd13ea32fa..3a544024338 100644
--- a/src/components/script/dom/webidls/Blob.webidl
+++ b/src/components/script/dom/webidls/Blob.webidl
@@ -1,28 +1,29 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/.
- *
- * The origin of this IDL file is
- * http://dev.w3.org/2006/webapi/FileAPI/#blob
- *
- * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
- * liability, trademark and document use rules apply.
- */
-
-[Constructor/*,
- Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blobParts, optional BlobPropertyBag option)*/]
+ * 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/. */
+
+// http://dev.w3.org/2006/webapi/FileAPI/#dfn-Blob
+//[Exposed=Window,Worker][Constructor,
+// Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blobParts, optional BlobPropertyBag options)]
+[Constructor]
interface Blob {
- readonly attribute unsigned long long size;
- readonly attribute DOMString type;
- Blob slice(/*[Clamp]*/ optional long long start,
- /*[Clamp]*/ optional long long end,
- optional DOMString contentType);
- void close();
-};
+ //readonly attribute unsigned long long size;
+ //readonly attribute DOMString type;
+ //readonly attribute boolean isClosed;
+ //slice Blob into byte-ranged chunks
+
+ //Blob slice([Clamp] optional long long start,
+ // [Clamp] optional long long end,
+ // optional DOMString contentType);
+ //void close();
+
+};
dictionary BlobPropertyBag {
+
DOMString type = "";
+
};
diff --git a/src/components/script/dom/webidls/Location.webidl b/src/components/script/dom/webidls/Location.webidl
index 33d4c2e0d30..99076988122 100644
--- a/src/components/script/dom/webidls/Location.webidl
+++ b/src/components/script/dom/webidls/Location.webidl
@@ -1,21 +1,12 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/.
- *
- * The origin of this IDL file is
- * http://www.whatwg.org/specs/web-apps/current-work/#the-location-interface
- *
- * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
- * Opera Software ASA. You are granted a license to use, reproduce
- * and create derivative works of this document.
- */
+ * 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/. */
-// No support for [Unforgeable] on interfaces yet
-//[Unforgeable]
-interface Location {
- void assign(DOMString url);
- void replace(DOMString url);
- void reload();
+// http://www.whatwg.org/html/#location
+/*[Unforgeable]*/ interface Location {
+ //void assign(DOMString url);
+ //void replace(DOMString url);
+ //void reload();
};
Location implements URLUtils;
diff --git a/src/components/script/dom/webidls/MouseEvent.webidl b/src/components/script/dom/webidls/MouseEvent.webidl
index 1886b7b02c5..cdef58228c1 100644
--- a/src/components/script/dom/webidls/MouseEvent.webidl
+++ b/src/components/script/dom/webidls/MouseEvent.webidl
@@ -1,75 +1,43 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
- *
- * For more information on this interface please see
- * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
- *
- * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
- * liability, trademark and document use rules apply.
- */
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEvent
+[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict)]
interface MouseEvent : UIEvent {
- readonly attribute long screenX;
- readonly attribute long screenY;
- readonly attribute long clientX;
- readonly attribute long clientY;
- readonly attribute boolean ctrlKey;
- readonly attribute boolean shiftKey;
- readonly attribute boolean altKey;
- readonly attribute boolean metaKey;
- readonly attribute unsigned short button;
- readonly attribute unsigned short buttons;
- readonly attribute EventTarget? relatedTarget;
- // Deprecated in DOM Level 3:
- void initMouseEvent(DOMString typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- Window? viewArg,
- long detailArg,
- long screenXArg,
- long screenYArg,
- long clientXArg,
- long clientYArg,
- boolean ctrlKeyArg,
- boolean altKeyArg,
- boolean shiftKeyArg,
- boolean metaKeyArg,
- unsigned short buttonArg,
- EventTarget? relatedTargetArg);
- // Introduced in DOM Level 3:
- boolean getModifierState(DOMString keyArg);
+ readonly attribute long screenX;
+ readonly attribute long screenY;
+ readonly attribute long clientX;
+ readonly attribute long clientY;
+ readonly attribute boolean ctrlKey;
+ readonly attribute boolean shiftKey;
+ readonly attribute boolean altKey;
+ readonly attribute boolean metaKey;
+ readonly attribute short button;
+ readonly attribute EventTarget? relatedTarget;
+ // Introduced in DOM Level 3
+ //readonly attribute unsigned short buttons;
+ //boolean getModifierState (DOMString keyArg);
};
-
-// Event Constructor Syntax:
-[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict)]
-partial interface MouseEvent
-{
+// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEventInit
+dictionary MouseEventInit : UIEventInit {
+ long screenX = 0;
+ long screenY = 0;
+ long clientX = 0;
+ long clientY = 0;
+ boolean ctrlKey = false;
+ boolean shiftKey = false;
+ boolean altKey = false;
+ boolean metaKey = false;
+ short button = 0;
+ //unsigned short buttons = 0;
+ EventTarget? relatedTarget = null;
};
-// Suggested initMouseEvent replacement initializer:
-dictionary MouseEventInit {
- // Attributes from Event:
- boolean bubbles = false;
- boolean cancelable = false;
-
- // Attributes from UIEvent:
- Window? view = null;
- long detail = 0;
-
- // Attributes for MouseEvent:
- long screenX = 0;
- long screenY = 0;
- long clientX = 0;
- long clientY = 0;
- boolean ctrlKey = false;
- boolean shiftKey = false;
- boolean altKey = false;
- boolean metaKey = false;
- unsigned short button = 0;
- // Note: "buttons" was not previously initializable through initMouseEvent!
- unsigned short buttons = 0;
- EventTarget? relatedTarget = null;
+// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEvent-1
+partial interface MouseEvent {
+ // Deprecated in DOM Level 3
+ void initMouseEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg, long screenXArg, long screenYArg, long clientXArg, long clientYArg, boolean ctrlKeyArg, boolean altKeyArg, boolean shiftKeyArg, boolean metaKeyArg, short buttonArg, EventTarget? relatedTargetArg);
};
diff --git a/src/components/script/dom/webidls/Navigator.webidl b/src/components/script/dom/webidls/Navigator.webidl
index d90c194dc3d..2023a6293ad 100644
--- a/src/components/script/dom/webidls/Navigator.webidl
+++ b/src/components/script/dom/webidls/Navigator.webidl
@@ -1,80 +1,27 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/.
- *
- * The origin of this IDL file is
- * http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
- * http://www.w3.org/TR/tracking-dnt/
- *
- * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
- * Opera Software ASA. You are granted a license to use, reproduce
- * and create derivative works of this document.
- */
+ * 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/. */
-// http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
+// http://www.whatwg.org/html/#navigator
interface Navigator {
// objects implementing this interface also implement the interfaces given below
};
Navigator implements NavigatorID;
-Navigator implements NavigatorLanguage;
-Navigator implements NavigatorOnLine;
+//Navigator implements NavigatorLanguage;
+//Navigator implements NavigatorOnLine;
//Navigator implements NavigatorContentUtils;
//Navigator implements NavigatorStorageUtils;
+//Navigator implements NavigatorPlugins;
-[NoInterfaceObject]
+// http://www.whatwg.org/html/#navigatorid
+[NoInterfaceObject, Exposed=Window,Worker]
interface NavigatorID {
+ readonly attribute DOMString appCodeName; // constant "Mozilla"
readonly attribute DOMString appName;
- [Throws]
- readonly attribute DOMString appVersion;
- [Throws]
+ //readonly attribute DOMString appVersion;
readonly attribute DOMString platform;
- [Throws]
- readonly attribute DOMString userAgent;
-
- // Spec has this as a const, but that's wrong because it should not
- // be on the interface object.
- //const DOMString product = "Gecko"; // for historical reasons
- readonly attribute DOMString product;
-};
-
-[NoInterfaceObject]
-interface NavigatorLanguage {
- readonly attribute DOMString? language;
-};
-
-[NoInterfaceObject]
-interface NavigatorOnLine {
- readonly attribute boolean onLine;
-};
-
-// http://www.w3.org/TR/tracking-dnt/ sort of
-partial interface Navigator {
- readonly attribute DOMString doNotTrack;
-};
-
-// Mozilla-specific extensions
-// nsIDOMNavigator
-partial interface Navigator {
- // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
- [Throws]
- readonly attribute DOMString appCodeName;
- //[Throws]
- //readonly attribute DOMString oscpu;
- // WebKit/Blink support this; Trident/Presto do not.
- readonly attribute DOMString vendor;
- // WebKit/Blink supports this (hardcoded ""); Trident/Presto do not.
- readonly attribute DOMString vendorSub;
- // WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't
- readonly attribute DOMString productSub;
- // WebKit/Blink/Trident/Presto support this.
- readonly attribute boolean cookieEnabled;
- [Throws]
- readonly attribute DOMString buildID;
-
- // WebKit/Blink/Trident/Presto support this.
- [Throws]
- boolean javaEnabled();
- // Everyone but WebKit/Blink supports this. See bug 679971.
- boolean taintEnabled();
+ readonly attribute DOMString product; // constant "Gecko"
+ boolean taintEnabled(); // constant false
+ //readonly attribute DOMString userAgent;
};
diff --git a/src/components/script/dom/webidls/UIEvent.webidl b/src/components/script/dom/webidls/UIEvent.webidl
index 16da6448724..4f5caeaad14 100644
--- a/src/components/script/dom/webidls/UIEvent.webidl
+++ b/src/components/script/dom/webidls/UIEvent.webidl
@@ -1,45 +1,25 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
- *
- * For more information on this interface please see
- * http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
- *
- * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
- * liability, trademark and document use rules apply.
- */
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEvent
[Constructor(DOMString type, optional UIEventInit eventInitDict)]
-interface UIEvent : Event
-{
+interface UIEvent : Event {
+ // readonly attribute WindowProxy? view;
readonly attribute Window? view;
- readonly attribute long detail;
- void initUIEvent(DOMString aType,
- boolean aCanBubble,
- boolean aCancelable,
- Window? aView,
- long aDetail);
+ readonly attribute long detail;
};
-// Additional DOM0 properties.
-partial interface UIEvent {
- const long SCROLL_PAGE_UP = -32768;
- const long SCROLL_PAGE_DOWN = 32768;
-
- readonly attribute long layerX;
- readonly attribute long layerY;
- readonly attribute long pageX;
- readonly attribute long pageY;
- readonly attribute unsigned long which;
- readonly attribute Node? rangeParent;
- readonly attribute long rangeOffset;
- attribute boolean cancelBubble;
- readonly attribute boolean isChar;
+// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEventInit
+dictionary UIEventInit : EventInit {
+ // WindowProxy? view = null;
+ Window? view = null;
+ long detail = 0;
};
-dictionary UIEventInit : EventInit
-{
- Window? view = null;
- long detail = 0;
+// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEvent-1
+partial interface UIEvent {
+ // Deprecated in DOM Level 3
+ void initUIEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg);
};
diff --git a/src/components/script/dom/webidls/URLUtils.webidl b/src/components/script/dom/webidls/URLUtils.webidl
index f65514ca53d..a3dd1560e43 100644
--- a/src/components/script/dom/webidls/URLUtils.webidl
+++ b/src/components/script/dom/webidls/URLUtils.webidl
@@ -1,32 +1,23 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/.
- *
- * The origin of this IDL file is
- * http://url.spec.whatwg.org/#urlutils
- *
- * To the extent possible under law, the editors have waived all copyright
- * and related or neighboring rights to this work. In addition, as of 17
- * February 2013, the editors have made this specification available under
- * the Open Web Foundation Agreement Version 1.0, which is available at
- * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
- */
+ * 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/. */
+// http://url.spec.whatwg.org/#urlutils
[NoInterfaceObject]
interface URLUtils {
- [SetterThrows]
- /* stringifier */ attribute DOMString href;
- readonly attribute DOMString origin;
+ //stringifier attribute ScalarValueString href;
+ readonly attribute DOMString href;
+ //readonly attribute ScalarValueString origin;
- attribute DOMString protocol;
- attribute DOMString username;
- attribute DOMString password;
- attribute DOMString host;
- attribute DOMString hostname;
- attribute DOMString port;
- attribute DOMString pathname;
- attribute DOMString search;
- // attribute URLQuery? query;
- attribute DOMString hash;
+ // attribute ScalarValueString protocol;
+ // attribute ScalarValueString username;
+ // attribute ScalarValueString password;
+ // attribute ScalarValueString host;
+ // attribute ScalarValueString hostname;
+ // attribute ScalarValueString port;
+ // attribute ScalarValueString pathname;
+ // attribute ScalarValueString search;
+ // attribute URLSearchParams searchParams;
+ // attribute ScalarValueString hash;
};
diff --git a/src/components/script/dom/webidls/ValidityState.webidl b/src/components/script/dom/webidls/ValidityState.webidl
index d8d1d1bccd8..d99677574cd 100644
--- a/src/components/script/dom/webidls/ValidityState.webidl
+++ b/src/components/script/dom/webidls/ValidityState.webidl
@@ -1,25 +1,19 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/.
- *
- * The origin of this IDL file is
- * http://www.whatwg.org/specs/web-apps/current-work/#validitystate
- * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
- * Opera Software ASA. You are granted a license to use, reproduce
- * and create derivative works of this document.
- */
+ * 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/. */
+// http://www.whatwg.org/html/#validitystate
interface ValidityState {
- readonly attribute boolean valueMissing;
- readonly attribute boolean typeMismatch;
- readonly attribute boolean patternMismatch;
- readonly attribute boolean tooLong;
- readonly attribute boolean rangeUnderflow;
- readonly attribute boolean rangeOverflow;
- readonly attribute boolean stepMismatch;
-// readonly attribute boolean badInput;
- readonly attribute boolean customError;
- readonly attribute boolean valid;
+ //readonly attribute boolean valueMissing;
+ //readonly attribute boolean typeMismatch;
+ //readonly attribute boolean patternMismatch;
+ //readonly attribute boolean tooLong;
+ //readonly attribute boolean tooShort;
+ //readonly attribute boolean rangeUnderflow;
+ //readonly attribute boolean rangeOverflow;
+ //readonly attribute boolean stepMismatch;
+ //readonly attribute boolean badInput;
+ //readonly attribute boolean customError;
+ //readonly attribute boolean valid;
};
-
diff --git a/src/components/script/dom/webidls/Window.webidl b/src/components/script/dom/webidls/Window.webidl
index f738f37ddee..dab6a23ba6c 100644
--- a/src/components/script/dom/webidls/Window.webidl
+++ b/src/components/script/dom/webidls/Window.webidl
@@ -1,95 +1,86 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/.
- *
- * The origin of this IDL file is:
- * http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-window-object
- */
+ * 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/. */
-[NamedPropertiesObject]
+// http://www.whatwg.org/html/#window
+[PrimaryGlobal]
/*sealed*/ interface Window : EventTarget {
// the current browsing context
- [Unforgeable] readonly attribute Window window;
- [Replaceable] readonly attribute Window self;
- [Unforgeable] readonly attribute Document document;
- attribute DOMString name;
- /* [PutForwards=href, Unforgeable] */ readonly attribute Location location;
- /* readonly attribute History history;
- [Replaceable] readonly attribute BarProp locationbar;
- [Replaceable] readonly attribute BarProp menubar;
- [Replaceable] readonly attribute BarProp personalbar;
- [Replaceable] readonly attribute BarProp scrollbars;
- [Replaceable] readonly attribute BarProp statusbar;
- [Replaceable] readonly attribute BarProp toolbar;*/
- attribute DOMString status;
+ //[Unforgeable] readonly attribute WindowProxy window;
+ //[Replaceable] readonly attribute WindowProxy self;
+ readonly attribute Window window;
+ readonly attribute Window self;
+ /*[Unforgeable]*/ readonly attribute Document document;
+ // attribute DOMString name;
+ /*[PutForwards=href, Unforgeable]*/ readonly attribute Location location;
+ //readonly attribute History history;
+ //[Replaceable] readonly attribute BarProp locationbar;
+ //[Replaceable] readonly attribute BarProp menubar;
+ //[Replaceable] readonly attribute BarProp personalbar;
+ //[Replaceable] readonly attribute BarProp scrollbars;
+ //[Replaceable] readonly attribute BarProp statusbar;
+ //[Replaceable] readonly attribute BarProp toolbar;
+ // attribute DOMString status;
void close();
- readonly attribute boolean closed;
- void stop();
- void focus();
- void blur();
+ //readonly attribute boolean closed;
+ //void stop();
+ //void focus();
+ //void blur();
// other browsing contexts
- /*[Replaceable] readonly attribute Window frames;
- [Replaceable] readonly attribute unsigned long length;
- [Unforgeable] readonly attribute Window top;
- attribute Window? opener;
- readonly attribute Window parent;*/
- readonly attribute Element? frameElement;
- /*Window open(optional DOMString url = "about:blank", optional DOMString target = "_blank", optional DOMString features = "", optional boolean replace = false);
- getter Window (unsigned long index);*/
+ //[Replaceable] readonly attribute WindowProxy frames;
+ //[Replaceable] readonly attribute unsigned long length;
+ //[Unforgeable] readonly attribute WindowProxy top;
+ // attribute any opener;
+ //readonly attribute WindowProxy parent;
+ //readonly attribute Element? frameElement;
+ //WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", optional DOMString features = "", optional boolean replace = false);
+ //getter WindowProxy (unsigned long index);
//getter object (DOMString name);
// the user agent
readonly attribute Navigator navigator;
- /*
- readonly attribute External external;
- readonly attribute ApplicationCache applicationCache;*/
+ //[Replaceable] readonly attribute External external;
+ //readonly attribute ApplicationCache applicationCache;
// user prompts
- void alert(optional DOMString message = "");
- boolean confirm(optional DOMString message = "");
- DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
- void print();
- any showModalDialog(DOMString url, optional any argument);
+ //void alert();
+ void alert(DOMString message);
+ //boolean confirm(optional DOMString message = "");
+ //DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
+ //void print();
+ //any showModalDialog(DOMString url, optional any argument);
+ //void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
+ // also has obsolete members
};
+Window implements GlobalEventHandlers;
+Window implements WindowEventHandlers;
-// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighResolutionTime/Overview.html
-partial interface Window {
- [Replaceable] readonly attribute Performance performance;
-};
-
-// Not part of any spec
-partial interface Window {
- // web developer niceties
- readonly attribute Console console;
-};
-
-/*Window implements GlobalEventHandlers;
- Window implements WindowEventHandlers;*/
-
-[NoInterfaceObject]
+// http://www.whatwg.org/html/#windowtimers
interface WindowTimers {
//long setTimeout(Function handler, optional long timeout = 0, any... arguments);
- //XXXjdm No support for Function or variadic arguments yet
- long setTimeout(any handler, optional long timeout = 0/*, any... arguments*/);
+ //long setTimeout(DOMString handler, optional long timeout = 0, any... arguments);
+ long setTimeout(any handler, optional long timeout = 0);
void clearTimeout(optional long handle = 0);
- long setInterval(any handler, optional long timeout = 0/*, any... arguments*/);
- void clearInterval(optional long handler = 0);
- /*long setTimeout(DOMString handler, optional long timeout = 0, any... arguments);
- long setInterval(Function handler, optional long timeout = 0, any... arguments);
- long setInterval(DOMString handler, optional long timeout = 0, any... arguments);
- void clearInterval(optional long handle = 0);*/
+ //long setInterval(Function handler, optional long timeout = 0, any... arguments);
+ //long setInterval(DOMString handler, optional long timeout = 0, any... arguments);
+ long setInterval(any handler, optional long timeout = 0);
+ void clearInterval(optional long handle = 0);
};
Window implements WindowTimers;
-Window implements GlobalEventHandlers;
-Window implements WindowEventHandlers;
-Window implements OnErrorEventHandlerForWindow;
+
+// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#sec-window.performance-attribute
+partial interface Window {
+ /*[Replaceable]*/ readonly attribute Performance performance;
+};
// Proprietary extensions.
partial interface Window {
+ readonly attribute Console console;
void debug(DOMString arg);
void gc();
};
+Window implements OnErrorEventHandlerForWindow;
diff --git a/src/components/script/dom/window.rs b/src/components/script/dom/window.rs
index 478fe0408d0..93f3ca24769 100644
--- a/src/components/script/dom/window.rs
+++ b/src/components/script/dom/window.rs
@@ -11,7 +11,6 @@ use dom::bindings::utils::{Reflectable, Reflector};
use dom::browsercontext::BrowserContext;
use dom::console::Console;
use dom::document::Document;
-use dom::element::Element;
use dom::eventtarget::{EventTarget, WindowTypeId, EventTargetHelpers};
use dom::location::Location;
use dom::navigator::Navigator;
@@ -27,7 +26,7 @@ use servo_util::url::parse_url;
use js::jsapi::JSContext;
use js::jsapi::{JS_GC, JS_GetRuntime};
-use js::jsval::{NullValue, JSVal};
+use js::jsval::JSVal;
use collections::hashmap::HashMap;
use std::cell::Cell;
@@ -120,22 +119,9 @@ pub trait WindowMethods {
fn Alert(&self, s: DOMString);
fn Close(&self);
fn Document(&self) -> Temporary<Document>;
- fn Name(&self) -> DOMString;
- fn SetName(&self, _name: DOMString);
- fn Status(&self) -> DOMString;
- fn SetStatus(&self, _status: DOMString);
- fn Closed(&self) -> bool;
- fn Stop(&self);
- fn Focus(&self);
- fn Blur(&self);
- fn GetFrameElement(&self) -> Option<Temporary<Element>>;
fn Location(&mut self) -> Temporary<Location>;
fn Console(&mut self) -> Temporary<Console>;
fn Navigator(&mut self) -> Temporary<Navigator>;
- fn Confirm(&self, _message: DOMString) -> bool;
- fn Prompt(&self, _message: DOMString, _default: DOMString) -> Option<DOMString>;
- fn Print(&self);
- fn ShowModalDialog(&self, _cx: *mut JSContext, _url: DOMString, _argument: Option<JSVal>) -> JSVal;
fn SetTimeout(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32;
fn ClearTimeout(&mut self, handle: i32);
fn SetInterval(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32;
@@ -169,37 +155,6 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
Temporary::new(frame.get_ref().document.clone())
}
- fn Name(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetName(&self, _name: DOMString) {
- }
-
- fn Status(&self) -> DOMString {
- "".to_owned()
- }
-
- fn SetStatus(&self, _status: DOMString) {
- }
-
- fn Closed(&self) -> bool {
- false
- }
-
- fn Stop(&self) {
- }
-
- fn Focus(&self) {
- }
-
- fn Blur(&self) {
- }
-
- fn GetFrameElement(&self) -> Option<Temporary<Element>> {
- None
- }
-
fn Location(&mut self) -> Temporary<Location> {
if self.location.get().is_none() {
let page = self.deref().page.clone();
@@ -225,21 +180,6 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
Temporary::new(self.navigator.get().get_ref().clone())
}
- fn Confirm(&self, _message: DOMString) -> bool {
- false
- }
-
- fn Prompt(&self, _message: DOMString, _default: DOMString) -> Option<DOMString> {
- None
- }
-
- fn Print(&self) {
- }
-
- fn ShowModalDialog(&self, _cx: *mut JSContext, _url: DOMString, _argument: Option<JSVal>) -> JSVal {
- NullValue()
- }
-
fn SetTimeout(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
self.set_timeout_or_interval(callback, timeout, false)
}
diff --git a/src/test/content/test_MouseEvent.html b/src/test/content/test_MouseEvent.html
index de826380c3b..9d17cdc801e 100644
--- a/src/test/content/test_MouseEvent.html
+++ b/src/test/content/test_MouseEvent.html
@@ -11,7 +11,6 @@ is_a(ev, UIEvent);
is_a(ev, MouseEvent);
is(ev.screenX, 150);
is(ev.detail, 100);
-is(ev.getModifierState("ctrl"), false);
finish();
</script>
diff --git a/src/test/content/test_navigator.html b/src/test/content/test_navigator.html
index 8ec7fc0ab3e..cb157086dbf 100644
--- a/src/test/content/test_navigator.html
+++ b/src/test/content/test_navigator.html
@@ -9,20 +9,11 @@ is(window.navigator, window.navigator);
is_a(window.navigator, Navigator);
var nav = window.navigator;
-is(nav.doNotTrack, "unspecified");
-is(nav.vendor, "");
-is(nav.vendorSub, "");
is(nav.product, "Gecko");
-is(nav.javaEnabled(), false);
is(nav.taintEnabled(), false);
is(nav.appName, "Netscape");
is(nav.appCodeName, "Mozilla");
-// todo
-is(nav.appVersion, "");
is(nav.platform, "");
-is(nav.userAgent, "");
-is(nav.language, null);
-is(nav.onLine, true);
finish();
</script>
</body>