From d91215680a8197b963cbe17b3525c9664ef58818 Mon Sep 17 00:00:00 2001 From: othree Date: Wed, 10 Dec 2014 01:28:23 +0800 Subject: [PATCH 1/4] Add WebIDL support and two sample file --- lib/linguist/languages.yml | 8 +++++++ samples/WebIDL/AnimationEvent.webidl | 25 ++++++++++++++++++++ samples/WebIDL/Fetch.webidl | 35 ++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 samples/WebIDL/AnimationEvent.webidl create mode 100644 samples/WebIDL/Fetch.webidl diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index d89aefdb..cca5ae69 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -3019,6 +3019,14 @@ Volt: tm_scope: source.d ace_mode: d +WebIDL: + type: programming + extensions: + - .webidl + tm_scope: none + ace_mode: none + + XC: type: programming extensions: diff --git a/samples/WebIDL/AnimationEvent.webidl b/samples/WebIDL/AnimationEvent.webidl new file mode 100644 index 00000000..e48ed571 --- /dev/null +++ b/samples/WebIDL/AnimationEvent.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/css3-animations/#animation-events- + * http://dev.w3.org/csswg/css3-animations/#animation-events- + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +[Constructor(DOMString type, optional AnimationEventInit eventInitDict)] +interface AnimationEvent : Event { + readonly attribute DOMString animationName; + readonly attribute float elapsedTime; + readonly attribute DOMString pseudoElement; +}; + +dictionary AnimationEventInit : EventInit { + DOMString animationName = ""; + float elapsedTime = 0; + DOMString pseudoElement = ""; +}; diff --git a/samples/WebIDL/Fetch.webidl b/samples/WebIDL/Fetch.webidl new file mode 100644 index 00000000..fb022126 --- /dev/null +++ b/samples/WebIDL/Fetch.webidl @@ -0,0 +1,35 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. + * + * The origin of this IDL file is + * http://fetch.spec.whatwg.org/ + */ + +typedef object JSON; +// FIXME(nsm): Bug 739173: FormData is not available in workers. +// typedef (ArrayBuffer or ArrayBufferView or Blob or FormData or USVString or URLSearchParams) BodyInit; +typedef (ArrayBuffer or ArrayBufferView or Blob or USVString or URLSearchParams) BodyInit; + +[NoInterfaceObject, Exposed=(Window,Worker)] +interface Body { + readonly attribute boolean bodyUsed; + [Throws] + Promise arrayBuffer(); + [Throws] + Promise blob(); + // FIXME(nsm): Bug 739173 FormData is not supported in workers. + // Promise formData(); + [Throws] + Promise json(); + [Throws] + Promise text(); +}; + +[NoInterfaceObject, Exposed=(Window,Worker)] +interface GlobalFetch { + [Throws, Func="mozilla::dom::Headers::PrefEnabled"] + Promise fetch(RequestInfo input, optional RequestInit init); +}; + From 4debcabb8833873c05c3743ce97d45372dab0ef8 Mon Sep 17 00:00:00 2001 From: othree Date: Wed, 10 Dec 2014 12:03:59 +0800 Subject: [PATCH 2/4] Add syntax define for WebIDL --- grammars.yml | 4 +++- lib/linguist/languages.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/grammars.yml b/grammars.yml index ae0245e4..0c3a0f16 100644 --- a/grammars.yml +++ b/grammars.yml @@ -421,4 +421,6 @@ https://github.com/wmertens/sublime-nix: https://raw.githubusercontent.com/eregon/oz-tmbundle/master/Syntaxes/Oz.tmLanguage: - source.oz https://raw.githubusercontent.com/tenbits/sublime-mask/release/Syntaxes/mask.tmLanguage: -- source.mask \ No newline at end of file +- source.mask +https://raw.githubusercontent.com/andik/IDL-Syntax/master/IDL.tmLanguage: +- source.webidl diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index cca5ae69..44064f8c 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -3023,7 +3023,7 @@ WebIDL: type: programming extensions: - .webidl - tm_scope: none + tm_scope: source.webidl ace_mode: none From 37c2bee3aeb6f08c69910013f9b0491512853e78 Mon Sep 17 00:00:00 2001 From: othree Date: Wed, 10 Dec 2014 14:18:25 +0800 Subject: [PATCH 3/4] Follow #1831, change WebIDL ace_mode to 'text' --- lib/linguist/languages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 44064f8c..d129fa0a 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -3024,7 +3024,7 @@ WebIDL: extensions: - .webidl tm_scope: source.webidl - ace_mode: none + ace_mode: text XC: From c72a49b77f71167b81a3bd30c946cf6471cd2a68 Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Thu, 11 Dec 2014 20:52:44 -0600 Subject: [PATCH 4/4] Whitespace --- lib/linguist/languages.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index e1b08727..34537f44 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -3026,7 +3026,6 @@ WebIDL: tm_scope: source.webidl ace_mode: text - XC: type: programming extensions: