mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 817194. Make WebIDL dictionary types sanely initialized by default; add a new Fast subclass to handle cases when we can skip the initialization safely. r=khuey
This commit is contained in:
parent
d248f3924a
commit
6195bac64d
2
CLOBBER
2
CLOBBER
@ -18,4 +18,4 @@
|
||||
# Modifying this file will now automatically clobber the buildbot machines \o/
|
||||
#
|
||||
|
||||
Bug 899574 needed a clobber, at least on Windows.
|
||||
Bug 817194 needs a clobber on Windows due to bug 924992.
|
||||
|
@ -526,11 +526,11 @@ nsDOMMutationObserver::TakeRecords(
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMMutationObserver::GetObservingInfo(nsTArray<Nullable<MutationObservingInfoInitializer> >& aResult)
|
||||
nsDOMMutationObserver::GetObservingInfo(nsTArray<Nullable<MutationObservingInfo> >& aResult)
|
||||
{
|
||||
aResult.SetCapacity(mReceivers.Count());
|
||||
for (int32_t i = 0; i < mReceivers.Count(); ++i) {
|
||||
MutationObservingInfoInitializer& info = aResult.AppendElement()->SetValue();
|
||||
MutationObservingInfo& info = aResult.AppendElement()->SetValue();
|
||||
nsMutationReceiver* mr = mReceivers[i];
|
||||
info.mChildList = mr->ChildList();
|
||||
info.mAttributes = mr->Attributes();
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "nsIDocument.h"
|
||||
|
||||
class nsDOMMutationObserver;
|
||||
using mozilla::dom::MutationObservingInfoInitializer;
|
||||
using mozilla::dom::MutationObservingInfo;
|
||||
|
||||
class nsDOMMutationRecord : public nsISupports,
|
||||
public nsWrapperCache
|
||||
@ -379,7 +379,7 @@ public:
|
||||
|
||||
void HandleMutation();
|
||||
|
||||
void GetObservingInfo(nsTArray<Nullable<MutationObservingInfoInitializer> >& aResult);
|
||||
void GetObservingInfo(nsTArray<Nullable<MutationObservingInfo> >& aResult);
|
||||
|
||||
mozilla::dom::MutationCallback* MutationCallback() { return mCallback; }
|
||||
|
||||
|
@ -911,7 +911,7 @@ WebGLContext::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::GetContextAttributes(Nullable<dom::WebGLContextAttributesInitializer> &retval)
|
||||
WebGLContext::GetContextAttributes(Nullable<dom::WebGLContextAttributes> &retval)
|
||||
{
|
||||
retval.SetNull();
|
||||
if (IsContextLost())
|
||||
|
@ -76,7 +76,6 @@ namespace dom {
|
||||
class ImageData;
|
||||
|
||||
struct WebGLContextAttributes;
|
||||
struct WebGLContextAttributesInitializer;
|
||||
template<typename> struct Nullable;
|
||||
}
|
||||
|
||||
@ -258,7 +257,7 @@ public:
|
||||
GLsizei DrawingBufferWidth() const { return IsContextLost() ? 0 : mWidth; }
|
||||
GLsizei DrawingBufferHeight() const { return IsContextLost() ? 0 : mHeight; }
|
||||
|
||||
void GetContextAttributes(dom::Nullable<dom::WebGLContextAttributesInitializer>& retval);
|
||||
void GetContextAttributes(dom::Nullable<dom::WebGLContextAttributes>& retval);
|
||||
bool IsContextLost() const { return mContextStatus != ContextNotLost; }
|
||||
void GetSupportedExtensions(JSContext *cx, dom::Nullable< nsTArray<nsString> > &retval);
|
||||
JSObject* GetExtension(JSContext* cx, const nsAString& aName, ErrorResult& rv);
|
||||
|
@ -492,7 +492,7 @@ MediaRecorder::CreateAndDispatchBlobEvent(Session *aSession)
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
BlobEventInitInitializer init;
|
||||
BlobEventInit init;
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = false;
|
||||
init.mData = aSession->GetEncodedData();
|
||||
|
@ -120,7 +120,7 @@ void
|
||||
TextTrackList::CreateAndDispatchTrackEventRunner(TextTrack* aTrack,
|
||||
const nsAString& aEventName)
|
||||
{
|
||||
TrackEventInitInitializer eventInit;
|
||||
TrackEventInit eventInit;
|
||||
eventInit.mBubbles = false;
|
||||
eventInit.mCancelable = false;
|
||||
eventInit.mTrack = aTrack;
|
||||
|
@ -713,7 +713,7 @@ SpeechRecognition::Start(ErrorResult& aRv)
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
MediaStreamConstraintsInitializer constraints;
|
||||
MediaStreamConstraints constraints;
|
||||
constraints.mAudio.SetAsBoolean() = true;
|
||||
|
||||
if (!mTestConfig.mFakeFSMEvents) {
|
||||
|
@ -4999,7 +4999,7 @@ nsGlobalWindow::DispatchResizeEvent(const nsIntSize& aSize)
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoCompartment ac(cx, mJSObject);
|
||||
DOMWindowResizeEventDetailInitializer detail;
|
||||
DOMWindowResizeEventDetail detail;
|
||||
detail.mWidth = aSize.width;
|
||||
detail.mHeight = aSize.height;
|
||||
JS::Rooted<JS::Value> detailValue(cx);
|
||||
|
@ -3544,9 +3544,13 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
assert not isOptional
|
||||
|
||||
typeName = CGDictionary.makeDictionaryName(type.inner)
|
||||
actualTypeName = typeName
|
||||
if not isMember:
|
||||
# Since we're not a member and not nullable or optional, no one will
|
||||
# see our real type, so we can do the fast version of the dictionary
|
||||
# that doesn't pre-initialize members.
|
||||
typeName = "detail::Fast" + typeName
|
||||
|
||||
declType = CGGeneric(actualTypeName)
|
||||
declType = CGGeneric(typeName)
|
||||
|
||||
# We do manual default value handling here, because we
|
||||
# actually do want a jsval, and we only handle null anyway
|
||||
@ -4424,8 +4428,7 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
|
||||
return result, True, rooter, None
|
||||
if returnType.isDictionary():
|
||||
nullable = returnType.nullable()
|
||||
dictName = (CGDictionary.makeDictionaryName(returnType.unroll().inner) +
|
||||
"Initializer")
|
||||
dictName = CGDictionary.makeDictionaryName(returnType.unroll().inner)
|
||||
result = CGGeneric(dictName)
|
||||
if not isMember and typeNeedsRooting(returnType):
|
||||
if nullable:
|
||||
@ -8379,7 +8382,20 @@ if (""",
|
||||
visibility="public",
|
||||
body=self.getMemberInitializer(m))
|
||||
for m in self.memberInfo]
|
||||
ctors = [ClassConstructor([], bodyInHeader=True, visibility="public")]
|
||||
ctors = [
|
||||
ClassConstructor(
|
||||
[],
|
||||
visibility="public",
|
||||
body=(
|
||||
"// Safe to pass a null context if we pass a null value\n"
|
||||
"Init(nullptr, JS::NullHandleValue);")),
|
||||
ClassConstructor(
|
||||
[Argument("int", "")],
|
||||
visibility="protected",
|
||||
explicit=True,
|
||||
bodyInHeader=True,
|
||||
body='// Do nothing here; this is used by our "Fast" subclass')
|
||||
]
|
||||
methods = []
|
||||
|
||||
if self.needToInitIds:
|
||||
@ -8413,17 +8429,23 @@ if (""",
|
||||
disallowCopyConstruction=disallowCopyConstruction)
|
||||
|
||||
|
||||
initializerCtor = ClassConstructor([],
|
||||
fastDictionaryCtor = ClassConstructor(
|
||||
[],
|
||||
visibility="public",
|
||||
body=(
|
||||
"// Safe to pass a null context if we pass a null value\n"
|
||||
"Init(nullptr, JS::NullHandleValue);"))
|
||||
initializerStruct = CGClass(selfName + "Initializer",
|
||||
bodyInHeader=True,
|
||||
baseConstructors=["%s(42)" % selfName],
|
||||
body="// Doesn't matter what int we pass to the parent constructor"
|
||||
)
|
||||
|
||||
fastStruct = CGClass("Fast" + selfName,
|
||||
bases=[ClassBase(selfName)],
|
||||
constructors=[initializerCtor],
|
||||
constructors=[fastDictionaryCtor],
|
||||
isStruct=True)
|
||||
|
||||
return CGList([struct, initializerStruct])
|
||||
return CGList([struct,
|
||||
CGNamespace.build(['detail'],
|
||||
fastStruct)],
|
||||
"\n")
|
||||
|
||||
def deps(self):
|
||||
return self.dictionary.getDeps()
|
||||
|
@ -587,7 +587,7 @@ public:
|
||||
// Dictionary tests
|
||||
void PassDictionary(JSContext*, const Dict&);
|
||||
void ReceiveDictionary(JSContext*, Dict&);
|
||||
void ReceiveNullableDictionary(JSContext*, Nullable<DictInitializer>&);
|
||||
void ReceiveNullableDictionary(JSContext*, Nullable<Dict>&);
|
||||
void PassOtherDictionary(const GrandparentDict&);
|
||||
void PassSequenceOfDictionaries(JSContext*, const Sequence<Dict>&);
|
||||
void PassDictionaryOrLong(JSContext*, const Dict&);
|
||||
|
@ -134,7 +134,7 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
|
||||
// aFeatures.
|
||||
|
||||
// Create the event's detail object.
|
||||
OpenWindowEventDetailInitializer detail;
|
||||
OpenWindowEventDetail detail;
|
||||
detail.mUrl = aURL;
|
||||
detail.mName = aName;
|
||||
detail.mFeatures = aFeatures;
|
||||
@ -307,7 +307,7 @@ NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
|
||||
NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// Create the event's detail object.
|
||||
AsyncScrollEventDetailInitializer detail;
|
||||
AsyncScrollEventDetail detail;
|
||||
detail.mLeft = mContentRect.x;
|
||||
detail.mTop = mContentRect.y;
|
||||
detail.mWidth = mContentRect.width;
|
||||
|
@ -244,7 +244,7 @@ GamepadService::FireButtonEvent(EventTarget* aTarget,
|
||||
{
|
||||
nsString name = aValue == 1.0L ? NS_LITERAL_STRING("gamepadbuttondown") :
|
||||
NS_LITERAL_STRING("gamepadbuttonup");
|
||||
GamepadButtonEventInitInitializer init;
|
||||
GamepadButtonEventInit init;
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = false;
|
||||
init.mGamepad = aGamepad;
|
||||
@ -307,7 +307,7 @@ GamepadService::FireAxisMoveEvent(EventTarget* aTarget,
|
||||
uint32_t aAxis,
|
||||
double aValue)
|
||||
{
|
||||
GamepadAxisMoveEventInitInitializer init;
|
||||
GamepadAxisMoveEventInit init;
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = false;
|
||||
init.mGamepad = aGamepad;
|
||||
@ -388,7 +388,7 @@ GamepadService::FireConnectionEvent(EventTarget* aTarget,
|
||||
{
|
||||
nsString name = aConnected ? NS_LITERAL_STRING("gamepadconnected") :
|
||||
NS_LITERAL_STRING("gamepaddisconnected");
|
||||
GamepadEventInitInitializer init;
|
||||
GamepadEventInit init;
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = false;
|
||||
init.mGamepad = aGamepad;
|
||||
|
@ -239,7 +239,7 @@ void
|
||||
nsDeviceSensors::FireDOMLightEvent(mozilla::dom::EventTarget* aTarget,
|
||||
double aValue)
|
||||
{
|
||||
DeviceLightEventInitInitializer init;
|
||||
DeviceLightEventInit init;
|
||||
init.mBubbles = true;
|
||||
init.mCancelable = false;
|
||||
init.mValue = aValue;
|
||||
@ -258,7 +258,7 @@ nsDeviceSensors::FireDOMProximityEvent(mozilla::dom::EventTarget* aTarget,
|
||||
double aMin,
|
||||
double aMax)
|
||||
{
|
||||
DeviceProximityEventInitInitializer init;
|
||||
DeviceProximityEventInit init;
|
||||
init.mBubbles = true;
|
||||
init.mCancelable = false;
|
||||
init.mValue = aValue;
|
||||
@ -289,7 +289,7 @@ void
|
||||
nsDeviceSensors::FireDOMUserProximityEvent(mozilla::dom::EventTarget* aTarget,
|
||||
bool aNear)
|
||||
{
|
||||
UserProximityEventInitInitializer init;
|
||||
UserProximityEventInit init;
|
||||
init.mBubbles = true;
|
||||
init.mCancelable = false;
|
||||
init.mNear = aNear;
|
||||
|
Loading…
Reference in New Issue
Block a user