Commit 4f15d4fa authored by David Tseng's avatar David Tseng Committed by Commit Bot

Fix nullptr dereference in WebAXObject

A WebAXObject holds  An AXObject as a WebPrivatePtr which holds a AXObjectCacheImpl Member.

In order to persist the AXObjectCacheImpl, we need to directly hold a Persistent<AXObjectCacheImpl> in ScopedActionAnnotator so that in our destructor, we can be guaranteed the AXObjectCacheImpl is still around.

Bug: 966935
Change-Id: I5c0c1322af58d5ee388e3ef448c0ccf767e50b34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1629184
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664588}
parent 1895b3a2
...@@ -103,16 +103,15 @@ class WebAXSparseAttributeClientAdapter : public AXSparseAttributeClient { ...@@ -103,16 +103,15 @@ class WebAXSparseAttributeClientAdapter : public AXSparseAttributeClient {
// AXObjCache handles programmatic actions. // AXObjCache handles programmatic actions.
class ScopedActionAnnotator { class ScopedActionAnnotator {
public: public:
explicit ScopedActionAnnotator(AXObject* obj) : obj_(obj) { explicit ScopedActionAnnotator(AXObject* obj)
obj_->AXObjectCache().set_is_handling_action(true); : cache_(&(obj->AXObjectCache())) {
cache_->set_is_handling_action(true);
} }
~ScopedActionAnnotator() { ~ScopedActionAnnotator() { cache_->set_is_handling_action(false); }
obj_->AXObjectCache().set_is_handling_action(false);
}
private: private:
Persistent<AXObject> obj_; Persistent<AXObjectCacheImpl> cache_;
}; };
static bool IsLayoutClean(Document* document) { static bool IsLayoutClean(Document* document) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment