зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #7230 - Support required dictionary members (fixes #7216) (from nox:required-dictionary-member); r=Ms2ger
Source-Repo: https://github.com/servo/servo Source-Revision: ef98e574297ed738f3b117c128bc578f623a35d5
This commit is contained in:
Родитель
d4e45231ec
Коммит
3c5a2d72f0
|
@ -918,7 +918,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
assert not type.treatNonObjectAsNull() or type.nullable()
|
||||
assert not type.treatNonObjectAsNull() or not type.treatNonCallableAsNull()
|
||||
|
||||
declType = CGGeneric('%s::%s' % (type.unroll().module(), type.unroll().identifier.name))
|
||||
callback = type.unroll().callback
|
||||
declType = CGGeneric('%s::%s' % (callback.module(), callback.identifier.name))
|
||||
finalDeclType = CGTemplatedType("Rc", declType)
|
||||
|
||||
conversion = CGCallbackTempRoot(declType.define())
|
||||
|
@ -1285,8 +1286,8 @@ def getRetvalDeclarationForType(returnType, descriptorProvider):
|
|||
result = CGWrapper(result, pre="Option<", post=">")
|
||||
return result
|
||||
if returnType.isCallback():
|
||||
result = CGGeneric('Rc<%s::%s>' % (returnType.unroll().module(),
|
||||
returnType.unroll().identifier.name))
|
||||
callback = returnType.unroll().callback
|
||||
result = CGGeneric('Rc<%s::%s>' % (callback.module(), callback.identifier.name))
|
||||
if returnType.nullable():
|
||||
result = CGWrapper(result, pre="Option<", post=">")
|
||||
return result
|
||||
|
@ -4798,7 +4799,7 @@ class CGDictionary(CGThing):
|
|||
def getMemberType(self, memberInfo):
|
||||
member, info = memberInfo
|
||||
declType = info.declType
|
||||
if not member.defaultValue:
|
||||
if member.optional and not member.defaultValue:
|
||||
declType = CGWrapper(info.declType, pre="Option<", post=">")
|
||||
return declType.define()
|
||||
|
||||
|
@ -4815,7 +4816,11 @@ class CGDictionary(CGThing):
|
|||
conversion = "%s.get()" % conversion
|
||||
|
||||
assert (member.defaultValue is None) == (default is None)
|
||||
if not default:
|
||||
if not member.optional:
|
||||
assert default is None
|
||||
default = ("throw_type_error(cx, \"Missing required member \\\"%s\\\".\");\n"
|
||||
"return Err(());") % member.identifier.name
|
||||
elif not default:
|
||||
default = "None"
|
||||
conversion = "Some(%s)" % conversion
|
||||
|
||||
|
@ -4935,7 +4940,7 @@ class CGBindingRoot(CGThing):
|
|||
|
||||
# Do codegen for all the callback interfaces.
|
||||
cgthings.extend(CGList([CGCallbackInterface(x),
|
||||
CGCallbackFunctionImpl(x)], "\n")
|
||||
CGCallbackFunctionImpl(x.interface)], "\n")
|
||||
for x in callbackDescriptors)
|
||||
|
||||
# And make sure we have the right number of newlines at the end
|
||||
|
@ -5258,7 +5263,7 @@ impl ToJSValConvertible for ${type} {
|
|||
self.callback().to_jsval(cx, rval);
|
||||
}
|
||||
}\
|
||||
""").substitute({"type": callback.name})
|
||||
""").substitute({"type": callback.identifier.name})
|
||||
CGGeneric.__init__(self, impl)
|
||||
|
||||
|
||||
|
@ -5687,7 +5692,7 @@ class GlobalGenRoots():
|
|||
def Bindings(config):
|
||||
|
||||
descriptors = (set(d.name + "Binding" for d in config.getDescriptors(register=True)) |
|
||||
set(d.unroll().module() for d in config.callbacks) |
|
||||
set(d.module() for d in config.callbacks) |
|
||||
set(d.module() for d in config.getDictionaries()))
|
||||
curr = CGList([CGGeneric("pub mod %s;\n" % name) for name in sorted(descriptors)])
|
||||
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -7,8 +7,17 @@
|
|||
|
||||
callback BrowserElementNextPaintEventCallback = void ();
|
||||
|
||||
//enum BrowserFindCaseSensitivity { "case-sensitive", "case-insensitive" };
|
||||
//enum BrowserFindDirection { "forward", "backward" };
|
||||
|
||||
//dictionary BrowserElementDownloadOptions {
|
||||
// DOMString? filename;
|
||||
// DOMString? referrer;
|
||||
//};
|
||||
|
||||
//dictionary BrowserElementExecuteScriptOptions {
|
||||
// DOMString? url;
|
||||
// DOMString? origin;
|
||||
//};
|
||||
|
||||
[NoInterfaceObject]
|
||||
|
@ -22,22 +31,32 @@ BrowserElement implements BrowserElementPrivileged;
|
|||
interface BrowserElementCommon {
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser embed-widgets"]
|
||||
// CheckAnyPermissions="browser embed-widgets"]
|
||||
//void setVisible(boolean visible);
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser embed-widgets"]
|
||||
// CheckAnyPermissions="browser embed-widgets"]
|
||||
//DOMRequest getVisible();
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser embed-widgets"]
|
||||
// CheckAnyPermissions="browser embed-widgets"]
|
||||
//void setActive(boolean active);
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckAnyPermissions="browser embed-widgets"]
|
||||
//boolean getActive();
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckAnyPermissions="browser embed-widgets"]
|
||||
//void addNextPaintListener(BrowserElementNextPaintEventCallback listener);
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser embed-widgets"]
|
||||
// CheckAnyPermissions="browser embed-widgets"]
|
||||
//void removeNextPaintListener(BrowserElementNextPaintEventCallback listener);
|
||||
};
|
||||
|
||||
|
@ -45,7 +64,7 @@ interface BrowserElementCommon {
|
|||
interface BrowserElementPrivileged {
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//void sendMouseEvent(DOMString type,
|
||||
// unsigned long x,
|
||||
// unsigned long y,
|
||||
|
@ -56,7 +75,7 @@ interface BrowserElementPrivileged {
|
|||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// Func="TouchEvent::PrefEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//void sendTouchEvent(DOMString type,
|
||||
// sequence<unsigned long> identifiers,
|
||||
// sequence<long> x,
|
||||
|
@ -70,70 +89,91 @@ interface BrowserElementPrivileged {
|
|||
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
CheckPermissions="browser"]
|
||||
CheckAnyPermissions="browser"]
|
||||
void goBack();
|
||||
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
CheckPermissions="browser"]
|
||||
CheckAnyPermissions="browser"]
|
||||
void goForward();
|
||||
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
CheckPermissions="browser"]
|
||||
CheckAnyPermissions="browser"]
|
||||
void reload(optional boolean hardReload = false);
|
||||
|
||||
[Throws,
|
||||
Pref="dom.mozBrowserFramesEnabled",
|
||||
CheckPermissions="browser"]
|
||||
CheckAnyPermissions="browser"]
|
||||
void stop();
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//DOMRequest download(DOMString url,
|
||||
// optional BrowserElementDownloadOptions options);
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//DOMRequest purgeHistory();
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//DOMRequest getScreenshot([EnforceRange] unsigned long width,
|
||||
// [EnforceRange] unsigned long height,
|
||||
// optional DOMString mimeType="");
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//void zoom(float zoom);
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//DOMRequest getCanGoBack();
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//DOMRequest getCanGoForward();
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAnyPermissions="browser"]
|
||||
//DOMRequest getContentDimensions();
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAllPermissions="browser input-manage"]
|
||||
//DOMRequest setInputMethodActive(boolean isActive);
|
||||
|
||||
// Additional |nfc-manager| permission is required for setNFCFocus API
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckPermissions="browser"]
|
||||
// CheckAllPermissions="browser nfc-manager"]
|
||||
//void setNFCFocus(boolean isFocus);
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckAnyPermissions="browser"]
|
||||
//void findAll(DOMString searchString, BrowserFindCaseSensitivity caseSensitivity);
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckAnyPermissions="browser"]
|
||||
//void findNext(BrowserFindDirection direction);
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckAnyPermissions="browser"]
|
||||
//void clearMatch();
|
||||
|
||||
//[Throws,
|
||||
// Pref="dom.mozBrowserFramesEnabled",
|
||||
// CheckAllPermissions="browser browser:universalxss"]
|
||||
//DOMRequest executeScript(DOMString script,
|
||||
// optional BrowserElementExecuteScriptOptions options);
|
||||
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
enum TestEnum { "", "foo", "bar" };
|
||||
|
||||
dictionary TestDictionary {
|
||||
required boolean requiredValue;
|
||||
boolean booleanValue;
|
||||
byte byteValue;
|
||||
octet octetValue;
|
||||
|
|
Загрузка…
Ссылка в новой задаче