Commit fe7c417a authored by jsbell@chromium.org's avatar jsbell@chromium.org

ServiceWorker: Update IDLs to use ScalarValueString

Based on the IDLs in the SW spec and now Fetch spec, use
ScalarValueString as appropriate.

Also, add cases to the overload resolution implementation for ByteString
(and ScalarValueString, though the spec hasn't caught up yet).

R=nbarth@chromium.org,haraken@chromium.org,horo@chromium.org
BUG=379009

Review URL: https://codereview.chromium.org/340943002

git-svn-id: svn://svn.chromium.org/blink/trunk@176531 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a726c781
...@@ -22,6 +22,10 @@ test(function() { ...@@ -22,6 +22,10 @@ test(function() {
request.url = 'http://localhost/'; request.url = 'http://localhost/';
assert_equals(request.url, 'http://localhost/', 'Request.url should be writable'); assert_equals(request.url, 'http://localhost/', 'Request.url should be writable');
request.url = 'http://localhost/\uD800'; // Unmatched lead surrogate.
assert_equals(request.url,
'http://localhost/' + encodeURIComponent('\uFFFD'),
'Request.url should have unmatched surrogates replaced.');
request.method = 'POST'; request.method = 'POST';
assert_equals(request.method, 'POST', 'Request.method should be writable'); assert_equals(request.method, 'POST', 'Request.method should be writable');
assert_throws({name: 'TypeError'}, function() { request.method = 'invalid \u0100'; }, assert_throws({name: 'TypeError'}, function() { request.method = 'invalid \u0100'; },
......
...@@ -761,9 +761,14 @@ def resolution_tests_methods(effective_overloads): ...@@ -761,9 +761,14 @@ def resolution_tests_methods(effective_overloads):
# types at position i of its type list, # types at position i of its type list,
# • DOMString # • DOMString
# • an enumeration type # • an enumeration type
# * ByteString
# Blink: ScalarValueString is a pending Web IDL addition
try: try:
method = next(method for idl_type, method in idl_types_methods method = next(method for idl_type, method in idl_types_methods
if idl_type.name == 'String' or idl_type.is_enum) if idl_type.name in ('String',
'ByteString',
'ScalarValueString') or
idl_type.is_enum)
yield 'true', method yield 'true', method
except StopIteration: except StopIteration:
pass pass
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#client-interface
[ [
Exposed=ServiceWorker, Exposed=ServiceWorker,
RuntimeEnabled=ServiceWorker RuntimeEnabled=ServiceWorker
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#fetch-event-interface
[ [
RuntimeEnabled=ServiceWorker, RuntimeEnabled=ServiceWorker,
Exposed=ServiceWorker Exposed=ServiceWorker
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#header-map-interface // http://fetch.spec.whatwg.org/#headers-class
// FIXME: Fetch spec has renamed this to just 'Headers'
// FIXME: This should be defined as MapClass(DOMString, DOMString) // FIXME: This should be defined as MapClass(DOMString, DOMString)
// once binding code supports it (http://crbug.com/347435). // once binding code supports it (http://crbug.com/347435).
[ [
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#install-event-interface
[ [
RuntimeEnabled=ServiceWorker, RuntimeEnabled=ServiceWorker,
Exposed=ServiceWorker, Exposed=ServiceWorker,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#install-phase-event-interface
[ [
RuntimeEnabled=ServiceWorker, RuntimeEnabled=ServiceWorker,
Exposed=ServiceWorker, Exposed=ServiceWorker,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#navigator-service-worker
[ [
RuntimeEnabled=ServiceWorker, RuntimeEnabled=ServiceWorker,
] partial interface Navigator { ] partial interface Navigator {
......
...@@ -13,6 +13,7 @@ struct RegistrationOptionList { ...@@ -13,6 +13,7 @@ struct RegistrationOptionList {
explicit RegistrationOptionList(const Dictionary& options) explicit RegistrationOptionList(const Dictionary& options)
: scope("*") : scope("*")
{ {
// FIXME: Should be ScalarValueString. http://crbug.com/379009
options.get("scope", scope); options.get("scope", scope);
} }
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#request-objects // http://fetch.spec.whatwg.org/#request-class
[ [
Constructor(optional Dictionary requestInitDict), Constructor(optional Dictionary requestInitDict),
RuntimeEnabled=ServiceWorker, RuntimeEnabled=ServiceWorker,
Exposed=ServiceWorker Exposed=ServiceWorker
] interface Request { ] interface Request {
attribute DOMString url; attribute ScalarValueString url;
attribute ByteString method; attribute ByteString method;
readonly attribute DOMString origin; readonly attribute DOMString origin;
readonly attribute HeaderMap headers; readonly attribute HeaderMap headers;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#response-objects // http://fetch.spec.whatwg.org/#response-class
// FIXME: Split this idl/impl into AbstractResponse and Response. // FIXME: Split this idl/impl into AbstractResponse and Response.
[ [
// FIXME: Add ctors for String, Stream, and ArrayBuffer/ArrayBufferView response bodies. // FIXME: Add ctors for String, Stream, and ArrayBuffer/ArrayBufferView response bodies.
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-interface
[ [
ActiveDOMObject, ActiveDOMObject,
RuntimeEnabled=ServiceWorker RuntimeEnabled=ServiceWorker
...@@ -35,8 +37,9 @@ ...@@ -35,8 +37,9 @@
// FIXME: Should inherit this from Worker. // FIXME: Should inherit this from Worker.
[Custom, RaisesException] void postMessage(SerializedScriptValue message, optional MessagePort[] messagePorts); [Custom, RaisesException] void postMessage(SerializedScriptValue message, optional MessagePort[] messagePorts);
readonly attribute DOMString scope; readonly attribute ScalarValueString scope;
readonly attribute DOMString url; readonly attribute ScalarValueString url;
// FIXME: Should be ServiceWorkerState enum, not DOMString.
readonly attribute DOMString state; readonly attribute DOMString state;
attribute EventHandler onstatechange; attribute EventHandler onstatechange;
}; };
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-clients-interface
[ [
Exposed=ServiceWorker, Exposed=ServiceWorker,
RuntimeEnabled=ServiceWorker RuntimeEnabled=ServiceWorker
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-container-interface
[ [
RuntimeEnabled=ServiceWorker RuntimeEnabled=ServiceWorker
] interface ServiceWorkerContainer { ] interface ServiceWorkerContainer {
...@@ -38,6 +39,6 @@ ...@@ -38,6 +39,6 @@
[CallWith=ScriptState] readonly attribute Promise ready; [CallWith=ScriptState] readonly attribute Promise ready;
[CallWith=ScriptState, ImplementedAs=registerServiceWorker] Promise register(DOMString url, optional Dictionary options); [CallWith=ScriptState, ImplementedAs=registerServiceWorker] Promise register(ScalarValueString url, optional Dictionary options);
[CallWith=ScriptState, ImplementedAs=unregisterServiceWorker] Promise unregister(optional DOMString scope); [CallWith=ScriptState, ImplementedAs=unregisterServiceWorker] Promise unregister(ScalarValueString scope);
}; };
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-global-scope-interface
[ [
Exposed=ServiceWorker, Exposed=ServiceWorker,
Global=Worker&ServiceWorker, Global=Worker&ServiceWorker,
...@@ -34,9 +36,9 @@ ...@@ -34,9 +36,9 @@
] interface ServiceWorkerGlobalScope : WorkerGlobalScope { ] interface ServiceWorkerGlobalScope : WorkerGlobalScope {
readonly attribute ServiceWorkerClients clients; readonly attribute ServiceWorkerClients clients;
[CallWith=ExecutionContext, Unforgeable] readonly attribute DOMString scope; [CallWith=ExecutionContext, Unforgeable] readonly attribute ScalarValueString scope;
[CallWith=ScriptState] Promise fetch(DOMString request); [CallWith=ScriptState] Promise fetch(ScalarValueString request);
[CallWith=ScriptState] Promise fetch(Request request); [CallWith=ScriptState] Promise fetch(Request request);
attribute EventHandler onactivate; attribute EventHandler onactivate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment