Changeset 244017 in webkit
- Timestamp:
- Apr 8, 2019, 5:39:58 AM (7 years ago)
- Location:
- releases/WebKitGTK/webkit-2.24/Source/WebCore
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
html/CanvasBase.cpp (modified) (1 diff)
-
html/CanvasBase.h (modified) (3 diffs)
-
html/CustomPaintCanvas.cpp (modified) (1 diff)
-
html/CustomPaintCanvas.h (modified) (2 diffs)
-
html/HTMLCanvasElement.cpp (modified) (1 diff)
-
html/HTMLCanvasElement.h (modified) (1 diff)
-
html/OffscreenCanvas.cpp (modified) (1 diff)
-
html/OffscreenCanvas.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog
r244015 r244017 1 2019-04-02 Ryosuke Niwa <rniwa@webkit.org> 2 3 Crash in HTMLCanvasElement::createContext2d after the element got adopted to a new document 4 https://bugs.webkit.org/show_bug.cgi?id=196527 5 6 Reviewed by Antti Koivisto. 7 8 We need to update CanvasBase::m_scriptExecutionContext when HTMLCanvasElement moves from 9 one document to another. Fixed the bug by making CanvasBase::scriptExecutionContext make 10 a virtual function call instead of directly storing a raw pointer. In HTMLCanvasElement, 11 we use Node::scriptExecutionContext(). Use ContextDestructionObserver in CustomPaintCanvas 12 and OffscreenCanvas instead of a raw pointer. 13 14 Unfortunately, no new tests since there is no reproducible test case. 15 16 * html/CanvasBase.cpp: 17 (WebCore::CanvasBase::CanvasBase): 18 * html/CanvasBase.h: 19 (WebCore::CanvasBase::scriptExecutionContext const): 20 * html/CustomPaintCanvas.cpp: 21 (WebCore::CustomPaintCanvas::CustomPaintCanvas): 22 * html/CustomPaintCanvas.h: 23 * html/HTMLCanvasElement.cpp: 24 (WebCore::HTMLCanvasElement::HTMLCanvasElement): 25 * html/HTMLCanvasElement.h: 26 * html/OffscreenCanvas.cpp: 27 (WebCore::OffscreenCanvas::OffscreenCanvas): 28 * html/OffscreenCanvas.h: 29 1 30 2019-03-26 Dean Jackson <dino@apple.com> 2 31 -
releases/WebKitGTK/webkit-2.24/Source/WebCore/html/CanvasBase.cpp
r237777 r244017 35 35 namespace WebCore { 36 36 37 CanvasBase::CanvasBase(ScriptExecutionContext* scriptExecutionContext) 38 : m_scriptExecutionContext(scriptExecutionContext) 37 CanvasBase::CanvasBase() 39 38 { 40 39 } -
releases/WebKitGTK/webkit-2.24/Source/WebCore/html/CanvasBase.h
r237777 r244017 75 75 76 76 virtual SecurityOrigin* securityOrigin() const { return nullptr; } 77 ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext;}77 ScriptExecutionContext* scriptExecutionContext() const { return canvasBaseScriptExecutionContext(); } 78 78 79 79 CanvasRenderingContext* renderingContext() const; … … 99 99 100 100 protected: 101 CanvasBase(ScriptExecutionContext*); 101 CanvasBase(); 102 103 virtual ScriptExecutionContext* canvasBaseScriptExecutionContext() const = 0; 102 104 103 105 std::unique_ptr<CanvasRenderingContext> m_context; … … 108 110 bool m_didNotifyObserversCanvasDestroyed { false }; 109 111 #endif 110 ScriptExecutionContext* m_scriptExecutionContext;111 112 HashSet<CanvasObserver*> m_observers; 112 113 }; -
releases/WebKitGTK/webkit-2.24/Source/WebCore/html/CustomPaintCanvas.cpp
r238839 r244017 40 40 41 41 CustomPaintCanvas::CustomPaintCanvas(ScriptExecutionContext& context, unsigned width, unsigned height) 42 : C anvasBase(&context)42 : ContextDestructionObserver(&context) 43 43 , m_size(width, height) 44 44 { -
releases/WebKitGTK/webkit-2.24/Source/WebCore/html/CustomPaintCanvas.h
r238839 r244017 45 45 class PaintRenderingContext2D; 46 46 47 class CustomPaintCanvas final : public RefCounted<CustomPaintCanvas>, public CanvasBase {47 class CustomPaintCanvas final : public RefCounted<CustomPaintCanvas>, public CanvasBase, private ContextDestructionObserver { 48 48 WTF_MAKE_FAST_ALLOCATED; 49 49 public: … … 81 81 void refCanvasBase() final { ref(); } 82 82 void derefCanvasBase() final { deref(); } 83 ScriptExecutionContext* canvasBaseScriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); } 83 84 84 85 mutable GraphicsContext* m_destinationGraphicsContext = nullptr; -
releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLCanvasElement.cpp
r241420 r244017 121 121 HTMLCanvasElement::HTMLCanvasElement(const QualifiedName& tagName, Document& document) 122 122 : HTMLElement(tagName, document) 123 , CanvasBase(&document)124 123 , m_size(defaultWidth, defaultHeight) 125 124 { -
releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLCanvasElement.h
r239427 r244017 186 186 void derefCanvasBase() final { HTMLElement::deref(); } 187 187 188 ScriptExecutionContext* canvasBaseScriptExecutionContext() const final { return HTMLElement::scriptExecutionContext(); } 189 188 190 FloatRect m_dirtyRect; 189 191 mutable IntSize m_size; -
releases/WebKitGTK/webkit-2.24/Source/WebCore/html/OffscreenCanvas.cpp
r237409 r244017 39 39 40 40 OffscreenCanvas::OffscreenCanvas(ScriptExecutionContext& context, unsigned width, unsigned height) 41 : C anvasBase(&context)41 : ContextDestructionObserver(&context) 42 42 , m_size(width, height) 43 43 { -
releases/WebKitGTK/webkit-2.24/Source/WebCore/html/OffscreenCanvas.h
r237344 r244017 46 46 #endif 47 47 48 class OffscreenCanvas final : public RefCounted<OffscreenCanvas>, public CanvasBase, public EventTargetWithInlineData {48 class OffscreenCanvas final : public RefCounted<OffscreenCanvas>, public CanvasBase, public EventTargetWithInlineData, private ContextDestructionObserver { 49 49 WTF_MAKE_FAST_ALLOCATED; 50 50 public: … … 95 95 bool isOffscreenCanvas() const final { return true; } 96 96 97 ScriptExecutionContext* scriptExecutionContext() const final { return CanvasBase::scriptExecutionContext(); } 97 ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); } 98 ScriptExecutionContext* canvasBaseScriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); } 98 99 99 100 EventTargetInterface eventTargetInterface() const final { return OffscreenCanvasEventTargetInterfaceType; }
Note:
See TracChangeset
for help on using the changeset viewer.