diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-06-27 14:10:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-27 14:10:49 +0200 |
commit | 9168a0fc95f523c7c852ca95969edb39069f4a03 (patch) | |
tree | d9e7ea0c5086235d0cfa7a7cc34f1760a4d74bb4 /widget/BasicEvents.h | |
parent | a3724697dc38820c4918b9e674ff56d2c15c5bba (diff) | |
parent | 783b60aae187d75c8c1924eceec8c4c56aa40c5e (diff) | |
download | UXP-9168a0fc95f523c7c852ca95969edb39069f4a03.tar UXP-9168a0fc95f523c7c852ca95969edb39069f4a03.tar.gz UXP-9168a0fc95f523c7c852ca95969edb39069f4a03.tar.lz UXP-9168a0fc95f523c7c852ca95969edb39069f4a03.tar.xz UXP-9168a0fc95f523c7c852ca95969edb39069f4a03.zip |
Merge pull request #554 from MoonchildProductions/issue12
Resolve potential null deref crashes in the editor
Diffstat (limited to 'widget/BasicEvents.h')
-rw-r--r-- | widget/BasicEvents.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h index a6228f179..960cb67c6 100644 --- a/widget/BasicEvents.h +++ b/widget/BasicEvents.h @@ -161,6 +161,9 @@ public: } inline void PreventDefault(bool aCalledByDefaultHandler = true) { + if (!mCancelable) { + return; + } mDefaultPrevented = true; // Note that even if preventDefault() has already been called by chrome, // a call of preventDefault() by content needs to overwrite @@ -175,6 +178,9 @@ public: // This should be used only before dispatching events into the DOM tree. inline void PreventDefaultBeforeDispatch() { + if (!mCancelable) { + return; + } mDefaultPrevented = true; } inline bool DefaultPrevented() const @@ -407,10 +413,16 @@ public: nsString mSpecifiedEventTypeString; // Event targets, needed by DOM Events + // Note that when you need event target for DOM event, you should use + // Get*DOMEventTarget() instead of accessing these members directly. nsCOMPtr<dom::EventTarget> mTarget; nsCOMPtr<dom::EventTarget> mCurrentTarget; nsCOMPtr<dom::EventTarget> mOriginalTarget; + dom::EventTarget* GetDOMEventTarget() const; + dom::EventTarget* GetCurrentDOMEventTarget() const; + dom::EventTarget* GetOriginalDOMEventTarget() const; + void AssignEventData(const WidgetEvent& aEvent, bool aCopyTargets) { // mClass should be initialized with the constructor. |