1/* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5// Note: This is a variant of WebIDL, but its semantics differ from our 6// internal WebIDL implementation. Some particular differences that are 7// relevent here include: 8// 9// - Attribute declarations refer directly to member variables of the 10// underlying class, and are not forwarded to explicit getter methods. 11// 12// - Attribute declarations also do not create getters on the JavaScript 13// wrapper object, but instead generate "get_foo()" and "set_foo()" 14// methods, which must be called in order to access the value. In the case 15// of array attributes, the callers must also pass the index they wish to 16// access. 17// 18// - Method overloading is fairly crude. Only explicitly declared variants 19// are supported, and selection is based entirely on index of the first 20// parameter whose value is undefined. 21// 22// - DOMString attributes are nullable by default. Null values are not 23// converted to empty strings, and non-null values are converted to 24// null-terminated, UTF-8 byte arrays. 25 26interface Language { 27 [Const] DOMString getLanguageCode(); 28}; 29 30interface LanguageGuess { 31 byte getPercent(); 32}; 33 34interface LanguageInfo { 35 static LanguageInfo detectLanguage(DOMString buffer, boolean isPlainText); 36 37 static LanguageInfo detectLanguage(DOMString buffer, boolean isPlainText, 38 DOMString? tldHint, long encodingHint, 39 DOMString? languageHint); 40 41 boolean getIsReliable(); 42 43 [BoundsChecked,Const] readonly attribute LanguageGuess[] languages; 44}; 45 46LanguageGuess implements Language; 47LanguageInfo implements Language; 48