Changeset 245347 in webkit
- Timestamp:
- May 15, 2019, 2:44:39 PM (7 years ago)
- Location:
- branches/safari-607-branch/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
-
branches/safari-607-branch/Source/WebCore/ChangeLog
r245346 r245347 1 2019-05-14 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r243820. rdar://problem/50753921 4 5 Crash in HTMLCanvasElement::createContext2d after the element got adopted to a new document 6 https://bugs.webkit.org/show_bug.cgi?id=196527 7 8 Reviewed by Antti Koivisto. 9 10 We need to update CanvasBase::m_scriptExecutionContext when HTMLCanvasElement moves from 11 one document to another. Fixed the bug by making CanvasBase::scriptExecutionContext make 12 a virtual function call instead of directly storing a raw pointer. In HTMLCanvasElement, 13 we use Node::scriptExecutionContext(). Use ContextDestructionObserver in CustomPaintCanvas 14 and OffscreenCanvas instead of a raw pointer. 15 16 Unfortunately, no new tests since there is no reproducible test case. 17 18 * html/CanvasBase.cpp: 19 (WebCore::CanvasBase::CanvasBase): 20 * html/CanvasBase.h: 21 (WebCore::CanvasBase::scriptExecutionContext const): 22 * html/CustomPaintCanvas.cpp: 23 (WebCore::CustomPaintCanvas::CustomPaintCanvas): 24 * html/CustomPaintCanvas.h: 25 * html/HTMLCanvasElement.cpp: 26 (WebCore::HTMLCanvasElement::HTMLCanvasElement): 27 * html/HTMLCanvasElement.h: 28 * html/OffscreenCanvas.cpp: 29 (WebCore::OffscreenCanvas::OffscreenCanvas): 30 * html/OffscreenCanvas.h: 31 32 33 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243820 268f45cc-cd09-0410-ab3c-d52691b4dbfc 34 35 2019-04-02 Ryosuke Niwa <rniwa@webkit.org> 36 37 Crash in HTMLCanvasElement::createContext2d after the element got adopted to a new document 38 https://bugs.webkit.org/show_bug.cgi?id=196527 39 40 Reviewed by Antti Koivisto. 41 42 We need to update CanvasBase::m_scriptExecutionContext when HTMLCanvasElement moves from 43 one document to another. Fixed the bug by making CanvasBase::scriptExecutionContext make 44 a virtual function call instead of directly storing a raw pointer. In HTMLCanvasElement, 45 we use Node::scriptExecutionContext(). Use ContextDestructionObserver in CustomPaintCanvas 46 and OffscreenCanvas instead of a raw pointer. 47 48 Unfortunately, no new tests since there is no reproducible test case. 49 50 * html/CanvasBase.cpp: 51 (WebCore::CanvasBase::CanvasBase): 52 * html/CanvasBase.h: 53 (WebCore::CanvasBase::scriptExecutionContext const): 54 * html/CustomPaintCanvas.cpp: 55 (WebCore::CustomPaintCanvas::CustomPaintCanvas): 56 * html/CustomPaintCanvas.h: 57 * html/HTMLCanvasElement.cpp: 58 (WebCore::HTMLCanvasElement::HTMLCanvasElement): 59 * html/HTMLCanvasElement.h: 60 * html/OffscreenCanvas.cpp: 61 (WebCore::OffscreenCanvas::OffscreenCanvas): 62 * html/OffscreenCanvas.h: 63 1 64 2019-05-14 Kocsen Chung <kocsen_chung@apple.com> 2 65 -
branches/safari-607-branch/Source/WebCore/html/CanvasBase.cpp
r237777 r245347 35 35 namespace WebCore { 36 36 37 CanvasBase::CanvasBase(ScriptExecutionContext* scriptExecutionContext) 38 : m_scriptExecutionContext(scriptExecutionContext) 37 CanvasBase::CanvasBase() 39 38 { 40 39 } -
branches/safari-607-branch/Source/WebCore/html/CanvasBase.h
r237777 r245347 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 }; -
branches/safari-607-branch/Source/WebCore/html/CustomPaintCanvas.cpp
r238839 r245347 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 { -
branches/safari-607-branch/Source/WebCore/html/CustomPaintCanvas.h
r238839 r245347 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; -
branches/safari-607-branch/Source/WebCore/html/HTMLCanvasElement.cpp
r241465 r245347 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 { -
branches/safari-607-branch/Source/WebCore/html/HTMLCanvasElement.h
r239427 r245347 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; -
branches/safari-607-branch/Source/WebCore/html/OffscreenCanvas.cpp
r237409 r245347 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 { -
branches/safari-607-branch/Source/WebCore/html/OffscreenCanvas.h
r237344 r245347 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.