mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +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)]
|
||||
unsafe fn get_subframe_window(cx: *mut JSContext,
|
||||
unsafe fn getSubframeWindow(cx: *mut JSContext,
|
||||
proxy: HandleObject,
|
||||
id: HandleId)
|
||||
-> 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());
|
||||
let win = root_from_handleobject::<Window>(target.handle()).unwrap();
|
||||
let mut found = false;
|
||||
return win.indexed_getter(index, &mut found);
|
||||
return win.IndexedGetter(index, &mut found);
|
||||
}
|
||||
|
||||
None
|
||||
|
@ -251,7 +251,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor(cx: *mut JSContext,
|
|||
id: HandleId,
|
||||
mut desc: MutableHandle<PropertyDescriptor>)
|
||||
-> bool {
|
||||
let window = get_subframe_window(cx, proxy, id);
|
||||
let window = getSubframeWindow(cx, proxy, id);
|
||||
if let Some(window) = window {
|
||||
rooted!(in(cx) let mut val = UndefinedValue());
|
||||
window.to_jsval(cx, val.handle_mut());
|
||||
|
@ -300,7 +300,7 @@ unsafe extern "C" fn has(cx: *mut JSContext,
|
|||
id: HandleId,
|
||||
bp: *mut bool)
|
||||
-> bool {
|
||||
let window = get_subframe_window(cx, proxy, id);
|
||||
let window = getSubframeWindow(cx, proxy, id);
|
||||
if window.is_some() {
|
||||
*bp = true;
|
||||
return true;
|
||||
|
@ -323,7 +323,7 @@ unsafe extern "C" fn get(cx: *mut JSContext,
|
|||
id: HandleId,
|
||||
vp: MutableHandleValue)
|
||||
-> bool {
|
||||
let window = get_subframe_window(cx, proxy, id);
|
||||
let window = getSubframeWindow(cx, proxy, id);
|
||||
if let Some(window) = window {
|
||||
window.to_jsval(cx, vp);
|
||||
return true;
|
||||
|
|
|
@ -49,7 +49,7 @@ impl DOMPointMethods for DOMPoint {
|
|||
|
||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
||||
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
|
||||
|
@ -59,7 +59,7 @@ impl DOMPointMethods for DOMPoint {
|
|||
|
||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
||||
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
|
||||
|
@ -69,7 +69,7 @@ impl DOMPointMethods for DOMPoint {
|
|||
|
||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
||||
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
|
||||
|
@ -79,6 +79,6 @@ impl DOMPointMethods for DOMPoint {
|
|||
|
||||
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
||||
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 {
|
||||
fn set_x(&self, value: f64);
|
||||
fn set_y(&self, value: f64);
|
||||
fn set_z(&self, value: f64);
|
||||
fn set_w(&self, value: f64);
|
||||
fn SetX(&self, value: f64);
|
||||
fn SetY(&self, value: f64);
|
||||
fn SetZ(&self, value: f64);
|
||||
fn SetW(&self, value: f64);
|
||||
}
|
||||
|
||||
impl DOMPointWriteMethods for DOMPointReadOnly {
|
||||
fn set_x(&self, value: f64) {
|
||||
fn SetX(&self, value: f64) {
|
||||
self.x.set(value);
|
||||
}
|
||||
|
||||
fn set_y(&self, value: f64) {
|
||||
fn SetY(&self, value: f64) {
|
||||
self.y.set(value);
|
||||
}
|
||||
|
||||
fn set_z(&self, value: f64) {
|
||||
fn SetZ(&self, value: f64) {
|
||||
self.z.set(value);
|
||||
}
|
||||
|
||||
fn set_w(&self, value: f64) {
|
||||
fn SetW(&self, value: f64) {
|
||||
self.w.set(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
None => USVString(String::new()),
|
||||
Some(ref url) => {
|
||||
// Steps 3-4.
|
||||
UrlHelper::hash(url)
|
||||
UrlHelper::Hash(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
None => return,
|
||||
// Steps 4-5.
|
||||
Some(url) => {
|
||||
UrlHelper::set_hash(url, value);
|
||||
UrlHelper::SetHash(url, value);
|
||||
DOMString::from(url.as_str())
|
||||
}
|
||||
};
|
||||
|
@ -195,7 +195,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
USVString(String::new())
|
||||
} else {
|
||||
// Steps 4-5.
|
||||
UrlHelper::host(url)
|
||||
UrlHelper::Host(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
None => return,
|
||||
// Step 4.
|
||||
Some(url) => {
|
||||
UrlHelper::set_host(url, value);
|
||||
UrlHelper::SetHost(url, value);
|
||||
DOMString::from(url.as_str())
|
||||
}
|
||||
};
|
||||
|
@ -231,7 +231,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
None => USVString(String::new()),
|
||||
Some(ref url) => {
|
||||
// Step 4.
|
||||
UrlHelper::hostname(url)
|
||||
UrlHelper::Hostname(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
None => return,
|
||||
// Step 4.
|
||||
Some(url) => {
|
||||
UrlHelper::set_hostname(url, value);
|
||||
UrlHelper::SetHostname(url, value);
|
||||
DOMString::from(url.as_str())
|
||||
}
|
||||
};
|
||||
|
@ -291,7 +291,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
// Step 3.
|
||||
None => USVString(String::new()),
|
||||
// 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,
|
||||
// Step 4.
|
||||
Some(url) => {
|
||||
UrlHelper::set_password(url, value);
|
||||
UrlHelper::SetPassword(url, value);
|
||||
DOMString::from(url.as_str())
|
||||
}
|
||||
};
|
||||
|
@ -324,7 +324,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
// Step 3.
|
||||
None => USVString(String::new()),
|
||||
// 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,
|
||||
// Step 5.
|
||||
Some(url) => {
|
||||
UrlHelper::set_pathname(url, value);
|
||||
UrlHelper::SetPathname(url, value);
|
||||
DOMString::from(url.as_str())
|
||||
}
|
||||
};
|
||||
|
@ -357,7 +357,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
// Step 3.
|
||||
None => USVString(String::new()),
|
||||
// Step 4.
|
||||
Some(ref url) => UrlHelper::port(url)
|
||||
Some(ref url) => UrlHelper::Port(url)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
None => return,
|
||||
// Step 4.
|
||||
Some(url) => {
|
||||
UrlHelper::set_port(url, value);
|
||||
UrlHelper::SetPort(url, value);
|
||||
DOMString::from(url.as_str())
|
||||
}
|
||||
};
|
||||
|
@ -391,7 +391,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
// Step 2.
|
||||
None => USVString(":".to_owned()),
|
||||
// Step 3.
|
||||
Some(ref url) => UrlHelper::protocol(url)
|
||||
Some(ref url) => UrlHelper::Protocol(url)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
None => return,
|
||||
// Step 3.
|
||||
Some(url) => {
|
||||
UrlHelper::set_protocol(url, value);
|
||||
UrlHelper::SetProtocol(url, value);
|
||||
DOMString::from(url.as_str())
|
||||
}
|
||||
};
|
||||
|
@ -422,7 +422,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
// Step 2.
|
||||
None => USVString(String::new()),
|
||||
// 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
|
||||
// encoding override (as described in the spec)
|
||||
Some(url) => {
|
||||
UrlHelper::set_search(url, value);
|
||||
UrlHelper::SetSearch(url, value);
|
||||
DOMString::from(url.as_str())
|
||||
}
|
||||
};
|
||||
|
@ -456,7 +456,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
// Step 2.
|
||||
None => USVString(String::new()),
|
||||
// Step 3.
|
||||
Some(ref url) => UrlHelper::username(url)
|
||||
Some(ref url) => UrlHelper::Username(url)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ impl HTMLAnchorElementMethods for HTMLAnchorElement {
|
|||
None => return,
|
||||
// Step 4.
|
||||
Some(url) => {
|
||||
UrlHelper::set_username(url, value);
|
||||
UrlHelper::SetUsername(url, value);
|
||||
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.upcast::<Node>().is_in_doc() {
|
||||
let window = window_from_node(iframe);
|
||||
|
@ -450,7 +450,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
|||
let self_url = 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())
|
||||
} else {
|
||||
None
|
||||
|
@ -479,12 +479,12 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
|
|||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/goBack
|
||||
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
|
||||
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
|
||||
|
@ -632,7 +632,7 @@ impl VirtualMethods for HTMLIFrameElement {
|
|||
// HTMLIFrameElement::contentDocument.
|
||||
let self_url = 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 {
|
||||
(None, None)
|
||||
|
|
|
@ -62,7 +62,7 @@ impl LocationMethods for Location {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-hash
|
||||
fn Hash(&self) -> USVString {
|
||||
UrlHelper::hash(&self.get_url())
|
||||
UrlHelper::Hash(&self.get_url())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-hash
|
||||
|
@ -70,37 +70,37 @@ impl LocationMethods for Location {
|
|||
if value.0.is_empty() {
|
||||
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
|
||||
fn Host(&self) -> USVString {
|
||||
UrlHelper::host(&self.get_url())
|
||||
UrlHelper::Host(&self.get_url())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-host
|
||||
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
|
||||
fn Origin(&self) -> USVString {
|
||||
UrlHelper::origin(&self.get_url())
|
||||
UrlHelper::Origin(&self.get_url())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-hostname
|
||||
fn Hostname(&self) -> USVString {
|
||||
UrlHelper::hostname(&self.get_url())
|
||||
UrlHelper::Hostname(&self.get_url())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-hostname
|
||||
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
|
||||
fn Href(&self) -> USVString {
|
||||
UrlHelper::href(&self.get_url())
|
||||
UrlHelper::Href(&self.get_url())
|
||||
}
|
||||
|
||||
// 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
|
||||
fn Pathname(&self) -> USVString {
|
||||
UrlHelper::pathname(&self.get_url())
|
||||
UrlHelper::Pathname(&self.get_url())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-pathname
|
||||
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
|
||||
fn Port(&self) -> USVString {
|
||||
UrlHelper::port(&self.get_url())
|
||||
UrlHelper::Port(&self.get_url())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-port
|
||||
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
|
||||
fn Protocol(&self) -> USVString {
|
||||
UrlHelper::protocol(&self.get_url())
|
||||
UrlHelper::Protocol(&self.get_url())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-protocol
|
||||
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
|
||||
|
@ -147,11 +147,11 @@ impl LocationMethods for Location {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-search
|
||||
fn Search(&self) -> USVString {
|
||||
UrlHelper::search(&self.get_url())
|
||||
UrlHelper::Search(&self.get_url())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-search
|
||||
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() {
|
||||
let it_window_root = it_context.active_window();
|
||||
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
|
||||
// objects are ignored by the event loop until the Document becomes fully active again.
|
||||
if ev_window.pipeline_id() != it_window.pipeline_id() {
|
||||
|
|
|
@ -176,37 +176,37 @@ impl URL {
|
|||
impl URLMethods for URL {
|
||||
// https://url.spec.whatwg.org/#dom-url-hash
|
||||
fn Hash(&self) -> USVString {
|
||||
UrlHelper::hash(&self.url.borrow())
|
||||
UrlHelper::Hash(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-hash
|
||||
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
|
||||
fn Host(&self) -> USVString {
|
||||
UrlHelper::host(&self.url.borrow())
|
||||
UrlHelper::Host(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-host
|
||||
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
|
||||
fn Hostname(&self) -> USVString {
|
||||
UrlHelper::hostname(&self.url.borrow())
|
||||
UrlHelper::Hostname(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-hostname
|
||||
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
|
||||
fn Href(&self) -> USVString {
|
||||
UrlHelper::href(&self.url.borrow())
|
||||
UrlHelper::Href(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-href
|
||||
|
@ -225,57 +225,57 @@ impl URLMethods for URL {
|
|||
|
||||
// https://url.spec.whatwg.org/#dom-url-password
|
||||
fn Password(&self) -> USVString {
|
||||
UrlHelper::password(&self.url.borrow())
|
||||
UrlHelper::Password(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-password
|
||||
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
|
||||
fn Pathname(&self) -> USVString {
|
||||
UrlHelper::pathname(&self.url.borrow())
|
||||
UrlHelper::Pathname(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-pathname
|
||||
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
|
||||
fn Port(&self) -> USVString {
|
||||
UrlHelper::port(&self.url.borrow())
|
||||
UrlHelper::Port(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-port
|
||||
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
|
||||
fn Protocol(&self) -> USVString {
|
||||
UrlHelper::protocol(&self.url.borrow())
|
||||
UrlHelper::Protocol(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-protocol
|
||||
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
|
||||
fn Origin(&self) -> USVString {
|
||||
UrlHelper::origin(&self.url.borrow())
|
||||
UrlHelper::Origin(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-search
|
||||
fn Search(&self) -> USVString {
|
||||
UrlHelper::search(&self.url.borrow())
|
||||
UrlHelper::Search(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-search
|
||||
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() {
|
||||
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
|
||||
fn Username(&self) -> USVString {
|
||||
UrlHelper::username(&self.url.borrow())
|
||||
UrlHelper::Username(&self.url.borrow())
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-username
|
||||
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;
|
||||
|
||||
impl UrlHelper {
|
||||
pub fn same_origin(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 href(url: &Url) -> USVString { USVString(quirks::href(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 port(url: &Url) -> USVString { USVString(quirks::port(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 password(url: &Url) -> USVString { USVString(quirks::password(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 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 set_host(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 set_search(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 set_hostname(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 set_protocol(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 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 Href(url: &Url) -> USVString { USVString(quirks::href(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 Port(url: &Url) -> USVString { USVString(quirks::port(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 Password(url: &Url) -> USVString { USVString(quirks::password(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 Username(url: &Url) -> USVString { USVString(quirks::username(url).to_owned()) }
|
||||
pub fn SetHash(url: &mut Url, value: USVString) { quirks::set_hash(url, &value.0) }
|
||||
pub fn SetHost(url: &mut Url, value: USVString) { let _ = quirks::set_host(url, &value.0); }
|
||||
pub fn SetPort(url: &mut Url, value: USVString) { let _ = quirks::set_port(url, &value.0); }
|
||||
pub fn SetSearch(url: &mut Url, value: USVString) { quirks::set_search(url, &value.0) }
|
||||
pub fn SetPathname(url: &mut Url, value: USVString) { quirks::set_pathname(url, &value.0) }
|
||||
pub fn SetHostname(url: &mut Url, value: USVString) { let _ = quirks::set_hostname(url, &value.0); }
|
||||
pub fn SetPassword(url: &mut Url, value: USVString) { let _ = quirks::set_password(url, &value.0); }
|
||||
pub fn SetProtocol(url: &mut Url, value: USVString) { let _ = quirks::set_protocol(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.
|
||||
let origin = UrlHelper::origin(&global.get_url()).0;
|
||||
let origin = UrlHelper::Origin(&global.get_url()).0;
|
||||
|
||||
// Step 7.
|
||||
let ws = WebSocket::new(global, resource_url.clone());
|
||||
|
|
|
@ -1536,7 +1536,7 @@ impl Window {
|
|||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
|
|
|
@ -37,42 +37,42 @@ impl WorkerLocation {
|
|||
impl WorkerLocationMethods for WorkerLocation {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-hash
|
||||
fn Hash(&self) -> USVString {
|
||||
UrlHelper::hash(&self.url)
|
||||
UrlHelper::Hash(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-host
|
||||
fn Host(&self) -> USVString {
|
||||
UrlHelper::host(&self.url)
|
||||
UrlHelper::Host(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-hostname
|
||||
fn Hostname(&self) -> USVString {
|
||||
UrlHelper::hostname(&self.url)
|
||||
UrlHelper::Hostname(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-href
|
||||
fn Href(&self) -> USVString {
|
||||
UrlHelper::href(&self.url)
|
||||
UrlHelper::Href(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-pathname
|
||||
fn Pathname(&self) -> USVString {
|
||||
UrlHelper::pathname(&self.url)
|
||||
UrlHelper::Pathname(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-port
|
||||
fn Port(&self) -> USVString {
|
||||
UrlHelper::port(&self.url)
|
||||
UrlHelper::Port(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-protocol
|
||||
fn Protocol(&self) -> USVString {
|
||||
UrlHelper::protocol(&self.url)
|
||||
UrlHelper::Protocol(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-search
|
||||
fn Search(&self) -> USVString {
|
||||
UrlHelper::search(&self.url)
|
||||
UrlHelper::Search(&self.url)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-workerlocation-href
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue