Move URL from WebCore to WTF
[WebKit-https.git] / Source / WebKitLegacy / mac / DOM / DOMHTMLScriptElement.mm
1 /*
2  * Copyright (C) 2004-2016 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import "DOMHTMLScriptElementInternal.h"
27
28 #import "DOMNodeInternal.h"
29 #import "ExceptionHandlers.h"
30 #import <WebCore/HTMLNames.h>
31 #import <WebCore/HTMLScriptElement.h>
32 #import <WebCore/JSExecState.h>
33 #import <WebCore/ThreadCheck.h>
34 #import <WebCore/WebScriptObjectPrivate.h>
35 #import <wtf/GetPtr.h>
36 #import <wtf/URL.h>
37
38 #define IMPL static_cast<WebCore::HTMLScriptElement*>(reinterpret_cast<WebCore::Node*>(_internal))
39
40 @implementation DOMHTMLScriptElement
41
42 - (NSString *)text
43 {
44     WebCore::JSMainThreadNullState state;
45     return IMPL->text();
46 }
47
48 - (void)setText:(NSString *)newText
49 {
50     WebCore::JSMainThreadNullState state;
51     IMPL->setText(newText);
52 }
53
54 - (NSString *)htmlFor
55 {
56     WebCore::JSMainThreadNullState state;
57     return IMPL->getAttribute(WebCore::HTMLNames::forAttr);
58 }
59
60 - (void)setHtmlFor:(NSString *)newHtmlFor
61 {
62     WebCore::JSMainThreadNullState state;
63     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::forAttr, newHtmlFor);
64 }
65
66 - (NSString *)event
67 {
68     WebCore::JSMainThreadNullState state;
69     return IMPL->getAttribute(WebCore::HTMLNames::eventAttr);
70 }
71
72 - (void)setEvent:(NSString *)newEvent
73 {
74     WebCore::JSMainThreadNullState state;
75     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::eventAttr, newEvent);
76 }
77
78 - (NSString *)charset
79 {
80     WebCore::JSMainThreadNullState state;
81     return IMPL->getAttribute(WebCore::HTMLNames::charsetAttr);
82 }
83
84 - (void)setCharset:(NSString *)newCharset
85 {
86     WebCore::JSMainThreadNullState state;
87     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::charsetAttr, newCharset);
88 }
89
90 - (BOOL)async
91 {
92     WebCore::JSMainThreadNullState state;
93     return IMPL->async();
94 }
95
96 - (void)setAsync:(BOOL)newAsync
97 {
98     WebCore::JSMainThreadNullState state;
99     IMPL->setAsync(newAsync);
100 }
101
102 - (BOOL)defer
103 {
104     WebCore::JSMainThreadNullState state;
105     return IMPL->hasAttributeWithoutSynchronization(WebCore::HTMLNames::deferAttr);
106 }
107
108 - (void)setDefer:(BOOL)newDefer
109 {
110     WebCore::JSMainThreadNullState state;
111     IMPL->setBooleanAttribute(WebCore::HTMLNames::deferAttr, newDefer);
112 }
113
114 - (NSString *)src
115 {
116     WebCore::JSMainThreadNullState state;
117     return IMPL->getURLAttribute(WebCore::HTMLNames::srcAttr);
118 }
119
120 - (void)setSrc:(NSString *)newSrc
121 {
122     WebCore::JSMainThreadNullState state;
123     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::srcAttr, newSrc);
124 }
125
126 - (NSString *)type
127 {
128     WebCore::JSMainThreadNullState state;
129     return IMPL->getAttribute(WebCore::HTMLNames::typeAttr);
130 }
131
132 - (void)setType:(NSString *)newType
133 {
134     WebCore::JSMainThreadNullState state;
135     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, newType);
136 }
137
138 - (NSString *)crossOrigin
139 {
140     WebCore::JSMainThreadNullState state;
141     return IMPL->crossOrigin();
142 }
143
144 - (void)setCrossOrigin:(NSString *)newCrossOrigin
145 {
146     WebCore::JSMainThreadNullState state;
147     IMPL->setCrossOrigin(newCrossOrigin);
148 }
149
150 - (NSString *)nonce
151 {
152     WebCore::JSMainThreadNullState state;
153     return IMPL->getAttribute(WebCore::HTMLNames::nonceAttr);
154 }
155
156 - (void)setNonce:(NSString *)newNonce
157 {
158     WebCore::JSMainThreadNullState state;
159     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::nonceAttr, newNonce);
160 }
161
162 @end
163
164 DOMHTMLScriptElement *kit(WebCore::HTMLScriptElement* value)
165 {
166     WebCoreThreadViolationCheckRoundOne();
167     return static_cast<DOMHTMLScriptElement*>(kit(static_cast<WebCore::Node*>(value)));
168 }