зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1038993
- Add UnsafeInPrerendering extended attribute to WebIDL. r=peterv
This commit is contained in:
Родитель
c1aba63374
Коммит
2d98c38825
|
@ -2356,6 +2356,14 @@ CheckPermissions(JSContext* aCx, JSObject* aObj, const char* const aPermissions[
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
CheckSafetyInPrerendering(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
//TODO: Check if page is being prerendered.
|
||||
//Returning false for now.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GenericBindingGetter(JSContext* cx, unsigned argc, JS::Value* vp)
|
||||
{
|
||||
|
|
|
@ -2937,6 +2937,10 @@ AssertReturnTypeMatchesJitinfo(const JSJitInfo* aJitinfo,
|
|||
bool
|
||||
CheckPermissions(JSContext* aCx, JSObject* aObj, const char* const aPermissions[]);
|
||||
|
||||
//Returns true if page is being prerendered.
|
||||
bool
|
||||
CheckSafetyInPrerendering(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
bool
|
||||
CallerSubsumes(JSObject* aObject);
|
||||
|
||||
|
|
|
@ -6320,6 +6320,21 @@ class CGPerSignatureCall(CGThing):
|
|||
self.arguments = arguments
|
||||
self.argCount = len(arguments)
|
||||
cgThings = []
|
||||
|
||||
# Here, we check if the current getter, setter, method, interface or
|
||||
# inherited interfaces have the UnsafeInPrerendering extended attribute
|
||||
# and if so, we add a check to make sure it is safe.
|
||||
if (idlNode.getExtendedAttribute("UnsafeInPrerendering") or
|
||||
descriptor.interface.getExtendedAttribute("UnsafeInPrerendering") or
|
||||
any(i.getExtendedAttribute("UnsafeInPrerendering")
|
||||
for i in descriptor.interface.getInheritedInterfaces())):
|
||||
cgThings.append(CGGeneric(dedent(
|
||||
"""
|
||||
if (mozilla::dom::CheckSafetyInPrerendering(cx, obj)) {
|
||||
//TODO: Handle call into unsafe API during Prerendering (Bug 730101)
|
||||
return false;
|
||||
}
|
||||
""")))
|
||||
lenientFloatCode = None
|
||||
if idlNode.getExtendedAttribute('LenientFloat') is not None:
|
||||
if setter:
|
||||
|
|
|
@ -1196,6 +1196,7 @@ class IDLInterface(IDLObjectWithScope):
|
|||
identifier == "OverrideBuiltins" or
|
||||
identifier == "ChromeOnly" or
|
||||
identifier == "Unforgeable" or
|
||||
identifier == "UnsafeInPrerendering" or
|
||||
identifier == "LegacyEventInit"):
|
||||
# Known extended attributes that do not take values
|
||||
if not attr.noArguments():
|
||||
|
@ -3309,6 +3310,7 @@ class IDLAttribute(IDLInterfaceMember):
|
|||
identifier == "Frozen" or
|
||||
identifier == "AvailableIn" or
|
||||
identifier == "NewObject" or
|
||||
identifier == "UnsafeInPrerendering" or
|
||||
identifier == "CheckPermissions"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
|
@ -3902,6 +3904,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
elif (identifier == "Throws" or
|
||||
identifier == "NewObject" or
|
||||
identifier == "ChromeOnly" or
|
||||
identifier == "UnsafeInPrerendering" or
|
||||
identifier == "Pref" or
|
||||
identifier == "Func" or
|
||||
identifier == "AvailableIn" or
|
||||
|
|
|
@ -184,6 +184,10 @@ public:
|
|||
int8_t CachedWritableByte();
|
||||
void SetCachedWritableByte(int8_t);
|
||||
|
||||
void UnsafePrerenderMethod();
|
||||
int32_t UnsafePrerenderWritable();
|
||||
void SetUnsafePrerenderWritable(int32_t);
|
||||
int32_t UnsafePrerenderReadonly();
|
||||
int16_t ReadonlyShort();
|
||||
int16_t WritableShort();
|
||||
void SetWritableShort(int16_t);
|
||||
|
|
|
@ -137,6 +137,12 @@ interface TestInterface {
|
|||
[StoreInSlot, Pure]
|
||||
attribute byte cachedWritableByte;
|
||||
|
||||
[UnsafeInPrerendering]
|
||||
void unsafePrerenderMethod();
|
||||
[UnsafeInPrerendering]
|
||||
attribute long unsafePrerenderWritable;
|
||||
[UnsafeInPrerendering]
|
||||
readonly attribute long unsafePrerenderReadonly;
|
||||
readonly attribute short readonlyShort;
|
||||
attribute short writableShort;
|
||||
void passShort(short arg);
|
||||
|
|
Загрузка…
Ссылка в новой задаче