aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/location.rs
blob: b59248346e5a0aead050a68a76eb77c9fd48a0d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* 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/. */

use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::utils::Fallible;
use dom::bindings::codegen::LocationBinding;
use dom::window::Window;
use servo_util::str::DOMString;

use script_task::{Page};

pub struct Location {
    reflector_: Reflector, //XXXjdm cycle: window->Location->window
    page: @mut Page
}

impl Location {
    pub fn new_inherited(page: @mut Page) -> Location {
        Location {
            reflector_: Reflector::new(),
            page: page
        }
    }

    pub fn new(window: &Window, page: @mut Page) -> @mut Location {
        reflect_dom_object(@mut Location::new_inherited(page), window, LocationBinding::Wrap)
    }

    pub fn Assign(&self, _url: DOMString) {

    }

    pub fn Replace(&self, _url: DOMString) {

    }

    pub fn Reload(&self) {

    }

    pub fn Href(&self) -> DOMString {
        self.page.url.get_ref().first().to_str()
    }

    pub fn SetHref(&self, _href: DOMString) -> Fallible<()> {
        Ok(())
    }

    pub fn Origin(&self) -> DOMString {
        ~""
    }

    pub fn Protocol(&self) -> DOMString {
        ~""
    }

    pub fn SetProtocol(&self, _protocol: DOMString) {

    }

    pub fn Username(&self) -> DOMString {
        ~""
    }

    pub fn SetUsername(&self, _username: DOMString) {

    }

    pub fn Password(&self) -> DOMString {
        ~""
    }

    pub fn SetPassword(&self, _password: DOMString) {

    }

    pub fn Host(&self) -> DOMString {
        ~""
    }

    pub fn SetHost(&self, _host: DOMString) {

    }

    pub fn Hostname(&self) -> DOMString {
        ~""
    }

    pub fn SetHostname(&self, _hostname: DOMString) {

    }

    pub fn Port(&self) -> DOMString {
        ~""
    }

    pub fn SetPort(&self, _port: DOMString) {

    }

    pub fn Pathname(&self) -> DOMString {
        ~""
    }

    pub fn SetPathname(&self, _pathname: DOMString) {

    }

    pub fn Search(&self) -> DOMString {
        ~""
    }

    pub fn SetSearch(&self, _search: DOMString) {

    }

    pub fn Hash(&self) -> DOMString {
        ~""
    }

    pub fn SetHash(&self, _hash: DOMString) {

    }
}

impl Reflectable for Location {
    fn reflector<'a>(&'a self) -> &'a Reflector {
        &self.reflector_
    }

    fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
        &mut self.reflector_
    }
}