mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Made fixes for PR.
This commit is contained in:
parent
7986423cd7
commit
b874e76455
12 changed files with 108 additions and 108 deletions
|
@ -230,7 +230,7 @@ impl SessionHistoryEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_subframe_window(cx: *mut JSContext,
|
unsafe fn getSubframeWindow(cx: *mut JSContext,
|
||||||
proxy: HandleObject,
|
proxy: HandleObject,
|
||||||
id: HandleId)
|
id: HandleId)
|
||||||
-> Option<Root<Window>> {
|
-> Option<Root<Window>> {
|
||||||
|
@ -239,7 +239,7 @@ unsafe fn get_subframe_window(cx: *mut JSContext,
|
||||||
rooted!(in(cx) let target = GetProxyPrivate(*proxy.ptr).to_object());
|
rooted!(in(cx) let target = GetProxyPrivate(*proxy.ptr).to_object());
|
||||||
let win = root_from_handleobject::<Window>(target.handle()).unwrap();
|
let win = root_from_handleobject::<Window>(target.handle()).unwrap();
|
||||||
let mut found = false;
|
let mut found = false;
|
||||||
return win.indexed_getter(index, &mut found);
|
return win.IndexedGetter(index, &mut found);
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
@ -251,7 +251,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor(cx: *mut JSContext,
|
||||||
id: HandleId,
|
id: HandleId,
|
||||||
mut desc: MutableHandle<PropertyDescriptor>)
|
mut desc: MutableHandle<PropertyDescriptor>)
|
||||||
-> bool {
|
-> bool {
|
||||||
let window = get_subframe_window(cx, proxy, id);
|
let window = getSubframeWindow(cx, proxy, id);
|
||||||
if let Some(window) = window {
|
if let Some(window) = window {
|
||||||
rooted!(in(cx) let mut val = UndefinedValue());
|
rooted!(in(cx) let mut val = UndefinedValue());
|
||||||
window.to_jsval(cx, val.handle_mut());
|
window.to_jsval(cx, val.handle_mut());
|
||||||
|
@ -300,7 +300,7 @@ unsafe extern "C" fn has(cx: *mut JSContext,
|
||||||
id: HandleId,
|
id: HandleId,
|
||||||
bp: *mut bool)
|
bp: *mut bool)
|
||||||
-> bool {
|
-> bool {
|
||||||
let window = get_subframe_window(cx, proxy, id);
|
let window = getSubframeWindow(cx, proxy, id);
|
||||||
if window.is_some() {
|
if window.is_some() {
|
||||||
*bp = true;
|
*bp = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -323,7 +323,7 @@ unsafe extern "C" fn get(cx: *mut JSContext,
|
||||||
id: HandleId,
|
id: HandleId,
|
||||||
vp: MutableHandleValue)
|
vp: MutableHandleValue)
|
||||||
-> bool {
|
-> bool {
|
||||||
let window = get_subframe_window(cx, proxy, id);
|
let window = getSubframeWindow(cx, proxy, id);
|
||||||
if let Some(window) = window {
|
if let Some(window) = window {
|
||||||
window.to_jsval(cx, vp);
|
window.to_jsval(cx, vp);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl DOMPointMethods for DOMPoint {
|
||||||
|
|
||||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
||||||
fn SetX(&self, value: f64) {
|
fn SetX(&self, value: f64) {
|
||||||
self.point.set_x(value);
|
self.point.SetX(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
||||||
|
@ -59,7 +59,7 @@ impl DOMPointMethods for DOMPoint {
|
||||||
|
|
||||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
||||||
fn SetY(&self, value: f64) {
|
fn SetY(&self, value: f64) {
|
||||||
self.point.set_y(value);
|
self.point.SetY(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
||||||
|
@ -69,7 +69,7 @@ impl DOMPointMethods for DOMPoint {
|
||||||
|
|
||||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
||||||
fn SetZ(&self, value: f64) {
|
fn SetZ(&self, value: f64) {
|
||||||
self.point.set_z(value);
|
self.point.SetZ(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
||||||
|
@ -79,6 +79,6 @@ impl DOMPointMethods for DOMPoint {
|
||||||
|
|
||||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
||||||
fn SetW(&self, value: f64) {
|
fn SetW(&self, value: f64) {
|
||||||
self.point.set_w(value);
|
self.point.SetW(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,26 +69,26 @@ impl DOMPointReadOnlyMethods for DOMPointReadOnly {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait DOMPointWriteMethods {
|
pub trait DOMPointWriteMethods {
|
||||||
fn set_x(&self, value: f64);
|
fn SetX(&self, value: f64);
|
||||||
fn set_y(&self, value: f64);
|
fn SetY(&self, value: f64);
|
||||||
fn set_z(&self, value: f64);
|
fn SetZ(&self, value: f64);
|
||||||
fn set_w(&self, value: f64);
|
fn SetW(&self, value: f64);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DOMPointWriteMethods for DOMPointReadOnly {
|
impl DOMPointWriteMethods for DOMPointReadOnly {
|
||||||
fn set_x(&self, value: f64) {
|
fn SetX(&self, value: f64) {
|
||||||
self.x.set(value);
|
self.x.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_y(&self, value: f64) {
|
fn SetY(&self, value: f64) {
|
||||||
self.y.set(value);
|
self.y.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_z(&self, value: f64) {
|
fn SetZ(&self, value: f64) {
|
||||||
self.z.set(value);
|
self.z.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_w(&self, value: f64) {
|
fn SetW(&self, value: f64) {
|
||||||
self.w.set(value);
|
self.w.set(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => USVString(String::new()),
|
None => USVString(String::new()),
|
||||||
Some(ref url) => {
|
Some(ref url) => {
|
||||||
// Steps 3-4.
|
// Steps 3-4.
|
||||||
UrlHelper::hash(url)
|
UrlHelper::Hash(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => return,
|
None => return,
|
||||||
// Steps 4-5.
|
// Steps 4-5.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_hash(url, value);
|
UrlHelper::SetHash(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -195,7 +195,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
USVString(String::new())
|
USVString(String::new())
|
||||||
} else {
|
} else {
|
||||||
// Steps 4-5.
|
// Steps 4-5.
|
||||||
UrlHelper::host(url)
|
UrlHelper::Host(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => return,
|
None => return,
|
||||||
// Step 4.
|
// Step 4.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_host(url, value);
|
UrlHelper::SetHost(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -231,7 +231,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => USVString(String::new()),
|
None => USVString(String::new()),
|
||||||
Some(ref url) => {
|
Some(ref url) => {
|
||||||
// Step 4.
|
// Step 4.
|
||||||
UrlHelper::hostname(url)
|
UrlHelper::Hostname(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => return,
|
None => return,
|
||||||
// Step 4.
|
// Step 4.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_hostname(url, value);
|
UrlHelper::SetHostname(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -291,7 +291,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
// Step 3.
|
// Step 3.
|
||||||
None => USVString(String::new()),
|
None => USVString(String::new()),
|
||||||
// Steps 3-4.
|
// Steps 3-4.
|
||||||
Some(ref url) => UrlHelper::password(url)
|
Some(ref url) => UrlHelper::Password(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => return,
|
None => return,
|
||||||
// Step 4.
|
// Step 4.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_password(url, value);
|
UrlHelper::SetPassword(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -324,7 +324,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
// Step 3.
|
// Step 3.
|
||||||
None => USVString(String::new()),
|
None => USVString(String::new()),
|
||||||
// Steps 4-5.
|
// Steps 4-5.
|
||||||
Some(ref url) => UrlHelper::pathname(url)
|
Some(ref url) => UrlHelper::Pathname(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => return,
|
None => return,
|
||||||
// Step 5.
|
// Step 5.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_pathname(url, value);
|
UrlHelper::SetPathname(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -357,7 +357,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
// Step 3.
|
// Step 3.
|
||||||
None => USVString(String::new()),
|
None => USVString(String::new()),
|
||||||
// Step 4.
|
// Step 4.
|
||||||
Some(ref url) => UrlHelper::port(url)
|
Some(ref url) => UrlHelper::Port(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => return,
|
None => return,
|
||||||
// Step 4.
|
// Step 4.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_port(url, value);
|
UrlHelper::SetPort(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -391,7 +391,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
// Step 2.
|
// Step 2.
|
||||||
None => USVString(":".to_owned()),
|
None => USVString(":".to_owned()),
|
||||||
// Step 3.
|
// Step 3.
|
||||||
Some(ref url) => UrlHelper::protocol(url)
|
Some(ref url) => UrlHelper::Protocol(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => return,
|
None => return,
|
||||||
// Step 3.
|
// Step 3.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_protocol(url, value);
|
UrlHelper::SetProtocol(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -422,7 +422,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
// Step 2.
|
// Step 2.
|
||||||
None => USVString(String::new()),
|
None => USVString(String::new()),
|
||||||
// Step 3.
|
// Step 3.
|
||||||
Some(ref url) => UrlHelper::search(url)
|
Some(ref url) => UrlHelper::Search(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
// TODO add this element's node document character encoding as
|
// TODO add this element's node document character encoding as
|
||||||
// encoding override (as described in the spec)
|
// encoding override (as described in the spec)
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_search(url, value);
|
UrlHelper::SetSearch(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -456,7 +456,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
// Step 2.
|
// Step 2.
|
||||||
None => USVString(String::new()),
|
None => USVString(String::new()),
|
||||||
// Step 3.
|
// Step 3.
|
||||||
Some(ref url) => UrlHelper::username(url)
|
Some(ref url) => UrlHelper::Username(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
||||||
None => return,
|
None => return,
|
||||||
// Step 4.
|
// Step 4.
|
||||||
Some(url) => {
|
Some(url) => {
|
||||||
UrlHelper::set_username(url, value);
|
UrlHelper::SetUsername(url, value);
|
||||||
DOMString::from(url.as_str())
|
DOMString::from(url.as_str())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -402,7 +402,7 @@ unsafe fn build_mozbrowser_event_detail(event: MozBrowserEvent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn navigate(iframe: &HTMLIFrameElement, direction: TraversalDirection) -> ErrorResult {
|
pub fn Navigate(iframe: &HTMLIFrameElement, direction: TraversalDirection) -> ErrorResult {
|
||||||
if iframe.Mozbrowser() {
|
if iframe.Mozbrowser() {
|
||||||
if iframe.upcast::<Node>().is_in_doc() {
|
if iframe.upcast::<Node>().is_in_doc() {
|
||||||
let window = window_from_node(iframe);
|
let window = window_from_node(iframe);
|
||||||
|
@ -450,7 +450,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
||||||
let self_url = self.get_url();
|
let self_url = self.get_url();
|
||||||
let win_url = window_from_node(self).get_url();
|
let win_url = window_from_node(self).get_url();
|
||||||
|
|
||||||
if UrlHelper::same_origin(&self_url, &win_url) {
|
if UrlHelper::SameOrigin(&self_url, &win_url) {
|
||||||
Some(window.Document())
|
Some(window.Document())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -479,12 +479,12 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goBack
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goBack
|
||||||
fn GoBack(&self) -> ErrorResult {
|
fn GoBack(&self) -> ErrorResult {
|
||||||
navigate(self, TraversalDirection::Back(1))
|
Navigate(self, TraversalDirection::Back(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goForward
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goForward
|
||||||
fn GoForward(&self) -> ErrorResult {
|
fn GoForward(&self) -> ErrorResult {
|
||||||
navigate(self, TraversalDirection::Forward(1))
|
Navigate(self, TraversalDirection::Forward(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/reload
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/reload
|
||||||
|
@ -632,7 +632,7 @@ impl VirtualMethods for HTMLIFrameElement {
|
||||||
// HTMLIFrameElement::contentDocument.
|
// HTMLIFrameElement::contentDocument.
|
||||||
let self_url = self.get_url();
|
let self_url = self.get_url();
|
||||||
let win_url = window_from_node(self).get_url();
|
let win_url = window_from_node(self).get_url();
|
||||||
UrlHelper::same_origin(&self_url, &win_url)
|
UrlHelper::SameOrigin(&self_url, &win_url)
|
||||||
};
|
};
|
||||||
let (sender, receiver) = if same_origin {
|
let (sender, receiver) = if same_origin {
|
||||||
(None, None)
|
(None, None)
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl LocationMethods for Location {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-hash
|
// https://html.spec.whatwg.org/multipage/#dom-location-hash
|
||||||
fn Hash(&self) -> USVString {
|
fn Hash(&self) -> USVString {
|
||||||
UrlHelper::hash(&self.get_url())
|
UrlHelper::Hash(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-hash
|
// https://html.spec.whatwg.org/multipage/#dom-location-hash
|
||||||
|
@ -70,37 +70,37 @@ impl LocationMethods for Location {
|
||||||
if value.0.is_empty() {
|
if value.0.is_empty() {
|
||||||
value = USVString("#".to_owned());
|
value = USVString("#".to_owned());
|
||||||
}
|
}
|
||||||
self.set_url_component(value, UrlHelper::set_hash);
|
self.set_url_component(value, UrlHelper::SetHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-host
|
// https://html.spec.whatwg.org/multipage/#dom-location-host
|
||||||
fn Host(&self) -> USVString {
|
fn Host(&self) -> USVString {
|
||||||
UrlHelper::host(&self.get_url())
|
UrlHelper::Host(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-host
|
// https://html.spec.whatwg.org/multipage/#dom-location-host
|
||||||
fn SetHost(&self, value: USVString) {
|
fn SetHost(&self, value: USVString) {
|
||||||
self.set_url_component(value, UrlHelper::set_host);
|
self.set_url_component(value, UrlHelper::SetHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-origin
|
// https://html.spec.whatwg.org/multipage/#dom-location-origin
|
||||||
fn Origin(&self) -> USVString {
|
fn Origin(&self) -> USVString {
|
||||||
UrlHelper::origin(&self.get_url())
|
UrlHelper::Origin(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-hostname
|
// https://html.spec.whatwg.org/multipage/#dom-location-hostname
|
||||||
fn Hostname(&self) -> USVString {
|
fn Hostname(&self) -> USVString {
|
||||||
UrlHelper::hostname(&self.get_url())
|
UrlHelper::Hostname(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-hostname
|
// https://html.spec.whatwg.org/multipage/#dom-location-hostname
|
||||||
fn SetHostname(&self, value: USVString) {
|
fn SetHostname(&self, value: USVString) {
|
||||||
self.set_url_component(value, UrlHelper::set_hostname);
|
self.set_url_component(value, UrlHelper::SetHostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-href
|
// https://html.spec.whatwg.org/multipage/#dom-location-href
|
||||||
fn Href(&self) -> USVString {
|
fn Href(&self) -> USVString {
|
||||||
UrlHelper::href(&self.get_url())
|
UrlHelper::Href(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-href
|
// https://html.spec.whatwg.org/multipage/#dom-location-href
|
||||||
|
@ -112,32 +112,32 @@ impl LocationMethods for Location {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-pathname
|
// https://html.spec.whatwg.org/multipage/#dom-location-pathname
|
||||||
fn Pathname(&self) -> USVString {
|
fn Pathname(&self) -> USVString {
|
||||||
UrlHelper::pathname(&self.get_url())
|
UrlHelper::Pathname(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-pathname
|
// https://html.spec.whatwg.org/multipage/#dom-location-pathname
|
||||||
fn SetPathname(&self, value: USVString) {
|
fn SetPathname(&self, value: USVString) {
|
||||||
self.set_url_component(value, UrlHelper::set_pathname);
|
self.set_url_component(value, UrlHelper::SetPathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-port
|
// https://html.spec.whatwg.org/multipage/#dom-location-port
|
||||||
fn Port(&self) -> USVString {
|
fn Port(&self) -> USVString {
|
||||||
UrlHelper::port(&self.get_url())
|
UrlHelper::Port(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-port
|
// https://html.spec.whatwg.org/multipage/#dom-location-port
|
||||||
fn SetPort(&self, value: USVString) {
|
fn SetPort(&self, value: USVString) {
|
||||||
self.set_url_component(value, UrlHelper::set_port);
|
self.set_url_component(value, UrlHelper::SetPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-protocol
|
// https://html.spec.whatwg.org/multipage/#dom-location-protocol
|
||||||
fn Protocol(&self) -> USVString {
|
fn Protocol(&self) -> USVString {
|
||||||
UrlHelper::protocol(&self.get_url())
|
UrlHelper::Protocol(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-protocol
|
// https://html.spec.whatwg.org/multipage/#dom-location-protocol
|
||||||
fn SetProtocol(&self, value: USVString) {
|
fn SetProtocol(&self, value: USVString) {
|
||||||
self.set_url_component(value, UrlHelper::set_protocol);
|
self.set_url_component(value, UrlHelper::SetProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-href
|
// https://html.spec.whatwg.org/multipage/#dom-location-href
|
||||||
|
@ -147,11 +147,11 @@ impl LocationMethods for Location {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-search
|
// https://html.spec.whatwg.org/multipage/#dom-location-search
|
||||||
fn Search(&self) -> USVString {
|
fn Search(&self) -> USVString {
|
||||||
UrlHelper::search(&self.get_url())
|
UrlHelper::Search(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-location-search
|
// https://html.spec.whatwg.org/multipage/#dom-location-search
|
||||||
fn SetSearch(&self, value: USVString) {
|
fn SetSearch(&self, value: USVString) {
|
||||||
self.set_url_component(value, UrlHelper::set_search);
|
self.set_url_component(value, UrlHelper::SetSearch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ impl Runnable for StorageEventRunnable {
|
||||||
for it_context in root_context.iter() {
|
for it_context in root_context.iter() {
|
||||||
let it_window_root = it_context.active_window();
|
let it_window_root = it_context.active_window();
|
||||||
let it_window = it_window_root.r();
|
let it_window = it_window_root.r();
|
||||||
assert!(UrlHelper::same_origin(&ev_url, &it_window.get_url()));
|
assert!(UrlHelper::SameOrigin(&ev_url, &it_window.get_url()));
|
||||||
// TODO: Such a Document object is not necessarily fully active, but events fired on such
|
// TODO: Such a Document object is not necessarily fully active, but events fired on such
|
||||||
// objects are ignored by the event loop until the Document becomes fully active again.
|
// objects are ignored by the event loop until the Document becomes fully active again.
|
||||||
if ev_window.pipeline_id() != it_window.pipeline_id() {
|
if ev_window.pipeline_id() != it_window.pipeline_id() {
|
||||||
|
|
|
@ -176,37 +176,37 @@ impl URL {
|
||||||
impl URLMethods for URL {
|
impl URLMethods for URL {
|
||||||
// https://url.spec.whatwg.org/#dom-url-hash
|
// https://url.spec.whatwg.org/#dom-url-hash
|
||||||
fn Hash(&self) -> USVString {
|
fn Hash(&self) -> USVString {
|
||||||
UrlHelper::hash(&self.url.borrow())
|
UrlHelper::Hash(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-hash
|
// https://url.spec.whatwg.org/#dom-url-hash
|
||||||
fn SetHash(&self, value: USVString) {
|
fn SetHash(&self, value: USVString) {
|
||||||
UrlHelper::set_hash(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetHash(&mut self.url.borrow_mut(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-host
|
// https://url.spec.whatwg.org/#dom-url-host
|
||||||
fn Host(&self) -> USVString {
|
fn Host(&self) -> USVString {
|
||||||
UrlHelper::host(&self.url.borrow())
|
UrlHelper::Host(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-host
|
// https://url.spec.whatwg.org/#dom-url-host
|
||||||
fn SetHost(&self, value: USVString) {
|
fn SetHost(&self, value: USVString) {
|
||||||
UrlHelper::set_host(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetHost(&mut self.url.borrow_mut(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-hostname
|
// https://url.spec.whatwg.org/#dom-url-hostname
|
||||||
fn Hostname(&self) -> USVString {
|
fn Hostname(&self) -> USVString {
|
||||||
UrlHelper::hostname(&self.url.borrow())
|
UrlHelper::Hostname(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-hostname
|
// https://url.spec.whatwg.org/#dom-url-hostname
|
||||||
fn SetHostname(&self, value: USVString) {
|
fn SetHostname(&self, value: USVString) {
|
||||||
UrlHelper::set_hostname(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetHostname(&mut self.url.borrow_mut(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-href
|
// https://url.spec.whatwg.org/#dom-url-href
|
||||||
fn Href(&self) -> USVString {
|
fn Href(&self) -> USVString {
|
||||||
UrlHelper::href(&self.url.borrow())
|
UrlHelper::Href(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-href
|
// https://url.spec.whatwg.org/#dom-url-href
|
||||||
|
@ -225,57 +225,57 @@ impl URLMethods for URL {
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-password
|
// https://url.spec.whatwg.org/#dom-url-password
|
||||||
fn Password(&self) -> USVString {
|
fn Password(&self) -> USVString {
|
||||||
UrlHelper::password(&self.url.borrow())
|
UrlHelper::Password(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-password
|
// https://url.spec.whatwg.org/#dom-url-password
|
||||||
fn SetPassword(&self, value: USVString) {
|
fn SetPassword(&self, value: USVString) {
|
||||||
UrlHelper::set_password(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetPassword(&mut self.url.borrow_mut(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-pathname
|
// https://url.spec.whatwg.org/#dom-url-pathname
|
||||||
fn Pathname(&self) -> USVString {
|
fn Pathname(&self) -> USVString {
|
||||||
UrlHelper::pathname(&self.url.borrow())
|
UrlHelper::Pathname(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-pathname
|
// https://url.spec.whatwg.org/#dom-url-pathname
|
||||||
fn SetPathname(&self, value: USVString) {
|
fn SetPathname(&self, value: USVString) {
|
||||||
UrlHelper::set_pathname(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetPathname(&mut self.url.borrow_mut(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-port
|
// https://url.spec.whatwg.org/#dom-url-port
|
||||||
fn Port(&self) -> USVString {
|
fn Port(&self) -> USVString {
|
||||||
UrlHelper::port(&self.url.borrow())
|
UrlHelper::Port(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-port
|
// https://url.spec.whatwg.org/#dom-url-port
|
||||||
fn SetPort(&self, value: USVString) {
|
fn SetPort(&self, value: USVString) {
|
||||||
UrlHelper::set_port(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetPort(&mut self.url.borrow_mut(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-protocol
|
// https://url.spec.whatwg.org/#dom-url-protocol
|
||||||
fn Protocol(&self) -> USVString {
|
fn Protocol(&self) -> USVString {
|
||||||
UrlHelper::protocol(&self.url.borrow())
|
UrlHelper::Protocol(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-protocol
|
// https://url.spec.whatwg.org/#dom-url-protocol
|
||||||
fn SetProtocol(&self, value: USVString) {
|
fn SetProtocol(&self, value: USVString) {
|
||||||
UrlHelper::set_protocol(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetProtocol(&mut self.url.borrow_mut(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-origin
|
// https://url.spec.whatwg.org/#dom-url-origin
|
||||||
fn Origin(&self) -> USVString {
|
fn Origin(&self) -> USVString {
|
||||||
UrlHelper::origin(&self.url.borrow())
|
UrlHelper::Origin(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-search
|
// https://url.spec.whatwg.org/#dom-url-search
|
||||||
fn Search(&self) -> USVString {
|
fn Search(&self) -> USVString {
|
||||||
UrlHelper::search(&self.url.borrow())
|
UrlHelper::Search(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-search
|
// https://url.spec.whatwg.org/#dom-url-search
|
||||||
fn SetSearch(&self, value: USVString) {
|
fn SetSearch(&self, value: USVString) {
|
||||||
UrlHelper::set_search(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetSearch(&mut self.url.borrow_mut(), value);
|
||||||
if let Some(search_params) = self.search_params.get() {
|
if let Some(search_params) = self.search_params.get() {
|
||||||
search_params.set_list(self.url.borrow().query_pairs().into_owned().collect());
|
search_params.set_list(self.url.borrow().query_pairs().into_owned().collect());
|
||||||
}
|
}
|
||||||
|
@ -293,11 +293,11 @@ impl URLMethods for URL {
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-username
|
// https://url.spec.whatwg.org/#dom-url-username
|
||||||
fn Username(&self) -> USVString {
|
fn Username(&self) -> USVString {
|
||||||
UrlHelper::username(&self.url.borrow())
|
UrlHelper::Username(&self.url.borrow())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-username
|
// https://url.spec.whatwg.org/#dom-url-username
|
||||||
fn SetUsername(&self, value: USVString) {
|
fn SetUsername(&self, value: USVString) {
|
||||||
UrlHelper::set_username(&mut self.url.borrow_mut(), value);
|
UrlHelper::SetUsername(&mut self.url.borrow_mut(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,25 +10,25 @@ use url::{Url, quirks};
|
||||||
pub struct UrlHelper;
|
pub struct UrlHelper;
|
||||||
|
|
||||||
impl UrlHelper {
|
impl UrlHelper {
|
||||||
pub fn same_origin(url_a: &Url, url_b: &Url) -> bool { url_a.origin() == url_b.origin() }
|
pub fn SameOrigin(url_a: &Url, url_b: &Url) -> bool { url_a.origin() == url_b.origin() }
|
||||||
pub fn origin(url: &Url) -> USVString { USVString(quirks::origin(url)) }
|
pub fn Origin(url: &Url) -> USVString { USVString(quirks::origin(url)) }
|
||||||
pub fn href(url: &Url) -> USVString { USVString(quirks::href(url).to_owned()) }
|
pub fn Href(url: &Url) -> USVString { USVString(quirks::href(url).to_owned()) }
|
||||||
pub fn hash(url: &Url) -> USVString { USVString(quirks::hash(url).to_owned()) }
|
pub fn Hash(url: &Url) -> USVString { USVString(quirks::hash(url).to_owned()) }
|
||||||
pub fn host(url: &Url) -> USVString { USVString(quirks::host(url).to_owned()) }
|
pub fn Host(url: &Url) -> USVString { USVString(quirks::host(url).to_owned()) }
|
||||||
pub fn port(url: &Url) -> USVString { USVString(quirks::port(url).to_owned()) }
|
pub fn Port(url: &Url) -> USVString { USVString(quirks::port(url).to_owned()) }
|
||||||
pub fn search(url: &Url) -> USVString { USVString(quirks::search(url).to_owned()) }
|
pub fn Search(url: &Url) -> USVString { USVString(quirks::search(url).to_owned()) }
|
||||||
pub fn hostname(url: &Url) -> USVString { USVString(quirks::hostname(url).to_owned()) }
|
pub fn Hostname(url: &Url) -> USVString { USVString(quirks::hostname(url).to_owned()) }
|
||||||
pub fn password(url: &Url) -> USVString { USVString(quirks::password(url).to_owned()) }
|
pub fn Password(url: &Url) -> USVString { USVString(quirks::password(url).to_owned()) }
|
||||||
pub fn pathname(url: &Url) -> USVString { USVString(quirks::pathname(url).to_owned()) }
|
pub fn Pathname(url: &Url) -> USVString { USVString(quirks::pathname(url).to_owned()) }
|
||||||
pub fn protocol(url: &Url) -> USVString { USVString(quirks::protocol(url).to_owned()) }
|
pub fn Protocol(url: &Url) -> USVString { USVString(quirks::protocol(url).to_owned()) }
|
||||||
pub fn username(url: &Url) -> USVString { USVString(quirks::username(url).to_owned()) }
|
pub fn Username(url: &Url) -> USVString { USVString(quirks::username(url).to_owned()) }
|
||||||
pub fn set_hash(url: &mut Url, value: USVString) { quirks::set_hash(url, &value.0) }
|
pub fn SetHash(url: &mut Url, value: USVString) { quirks::set_hash(url, &value.0) }
|
||||||
pub fn set_host(url: &mut Url, value: USVString) { let _ = quirks::set_host(url, &value.0); }
|
pub fn SetHost(url: &mut Url, value: USVString) { let _ = quirks::set_host(url, &value.0); }
|
||||||
pub fn set_port(url: &mut Url, value: USVString) { let _ = quirks::set_port(url, &value.0); }
|
pub fn SetPort(url: &mut Url, value: USVString) { let _ = quirks::set_port(url, &value.0); }
|
||||||
pub fn set_search(url: &mut Url, value: USVString) { quirks::set_search(url, &value.0) }
|
pub fn SetSearch(url: &mut Url, value: USVString) { quirks::set_search(url, &value.0) }
|
||||||
pub fn set_pathname(url: &mut Url, value: USVString) { quirks::set_pathname(url, &value.0) }
|
pub fn SetPathname(url: &mut Url, value: USVString) { quirks::set_pathname(url, &value.0) }
|
||||||
pub fn set_hostname(url: &mut Url, value: USVString) { let _ = quirks::set_hostname(url, &value.0); }
|
pub fn SetHostname(url: &mut Url, value: USVString) { let _ = quirks::set_hostname(url, &value.0); }
|
||||||
pub fn set_password(url: &mut Url, value: USVString) { let _ = quirks::set_password(url, &value.0); }
|
pub fn SetPassword(url: &mut Url, value: USVString) { let _ = quirks::set_password(url, &value.0); }
|
||||||
pub fn set_protocol(url: &mut Url, value: USVString) { let _ = quirks::set_protocol(url, &value.0); }
|
pub fn SetProtocol(url: &mut Url, value: USVString) { let _ = quirks::set_protocol(url, &value.0); }
|
||||||
pub fn set_username(url: &mut Url, value: USVString) { let _ = quirks::set_username(url, &value.0); }
|
pub fn SetUsername(url: &mut Url, value: USVString) { let _ = quirks::set_username(url, &value.0); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ impl WebSocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 6: Origin.
|
// Step 6: Origin.
|
||||||
let origin = UrlHelper::origin(&global.get_url()).0;
|
let origin = UrlHelper::Origin(&global.get_url()).0;
|
||||||
|
|
||||||
// Step 7.
|
// Step 7.
|
||||||
let ws = WebSocket::new(global, resource_url.clone());
|
let ws = WebSocket::new(global, resource_url.clone());
|
||||||
|
|
|
@ -1536,7 +1536,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#accessing-other-browsing-contexts
|
// https://html.spec.whatwg.org/multipage/#accessing-other-browsing-contexts
|
||||||
pub fn indexed_getter(&self, _index: u32, _found: &mut bool) -> Option<Root<Window>> {
|
pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<Root<Window>> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,42 +37,42 @@ impl WorkerLocation {
|
||||||
impl WorkerLocationMethods for WorkerLocation {
|
impl WorkerLocationMethods for WorkerLocation {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-hash
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-hash
|
||||||
fn Hash(&self) -> USVString {
|
fn Hash(&self) -> USVString {
|
||||||
UrlHelper::hash(&self.url)
|
UrlHelper::Hash(&self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-host
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-host
|
||||||
fn Host(&self) -> USVString {
|
fn Host(&self) -> USVString {
|
||||||
UrlHelper::host(&self.url)
|
UrlHelper::Host(&self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-hostname
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-hostname
|
||||||
fn Hostname(&self) -> USVString {
|
fn Hostname(&self) -> USVString {
|
||||||
UrlHelper::hostname(&self.url)
|
UrlHelper::Hostname(&self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-href
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-href
|
||||||
fn Href(&self) -> USVString {
|
fn Href(&self) -> USVString {
|
||||||
UrlHelper::href(&self.url)
|
UrlHelper::Href(&self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-pathname
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-pathname
|
||||||
fn Pathname(&self) -> USVString {
|
fn Pathname(&self) -> USVString {
|
||||||
UrlHelper::pathname(&self.url)
|
UrlHelper::Pathname(&self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-port
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-port
|
||||||
fn Port(&self) -> USVString {
|
fn Port(&self) -> USVString {
|
||||||
UrlHelper::port(&self.url)
|
UrlHelper::Port(&self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-protocol
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-protocol
|
||||||
fn Protocol(&self) -> USVString {
|
fn Protocol(&self) -> USVString {
|
||||||
UrlHelper::protocol(&self.url)
|
UrlHelper::Protocol(&self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-search
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-search
|
||||||
fn Search(&self) -> USVString {
|
fn Search(&self) -> USVString {
|
||||||
UrlHelper::search(&self.url)
|
UrlHelper::Search(&self.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-href
|
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-href
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue