| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "WebSettings.h" | 52 #include "WebSettings.h" |
| 53 #include "WebSpellCheckClient.h" | 53 #include "WebSpellCheckClient.h" |
| 54 #include "WebTextCheckingCompletion.h" | 54 #include "WebTextCheckingCompletion.h" |
| 55 #include "WebTextCheckingResult.h" | 55 #include "WebTextCheckingResult.h" |
| 56 #include "WebViewClient.h" | 56 #include "WebViewClient.h" |
| 57 #include "WebViewImpl.h" | 57 #include "WebViewImpl.h" |
| 58 #include "core/dom/Clipboard.h" | 58 #include "core/dom/Clipboard.h" |
| 59 #include "core/dom/DocumentMarkerController.h" | 59 #include "core/dom/DocumentMarkerController.h" |
| 60 #include "core/dom/MouseEvent.h" | 60 #include "core/dom/MouseEvent.h" |
| 61 #include "core/dom/Range.h" | 61 #include "core/dom/Range.h" |
| 62 #include "core/editing/Editor.h" |
| 62 #include "core/editing/FrameSelection.h" | 63 #include "core/editing/FrameSelection.h" |
| 64 #include "core/editing/SpellChecker.h" |
| 63 #include "core/html/HTMLFormElement.h" | 65 #include "core/html/HTMLFormElement.h" |
| 64 #include "core/loader/FrameLoadRequest.h" | 66 #include "core/loader/FrameLoadRequest.h" |
| 65 #include "core/page/EventHandler.h" | 67 #include "core/page/EventHandler.h" |
| 66 #include "core/page/Frame.h" | 68 #include "core/page/Frame.h" |
| 67 #include "core/page/FrameView.h" | 69 #include "core/page/FrameView.h" |
| 68 #include "core/page/Settings.h" | 70 #include "core/page/Settings.h" |
| 69 #include "core/platform/ScrollbarTheme.h" | 71 #include "core/platform/ScrollbarTheme.h" |
| 70 #include "core/platform/graphics/FloatRect.h" | 72 #include "core/platform/graphics/FloatRect.h" |
| 71 #include "core/platform/network/ResourceError.h" | 73 #include "core/platform/network/ResourceError.h" |
| 72 #include "core/rendering/HitTestResult.h" | 74 #include "core/rendering/HitTestResult.h" |
| (...skipping 3082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3155 spellcheck.kick(); | 3157 spellcheck.kick(); |
| 3156 | 3158 |
| 3157 WebVector<uint32_t> documentMarkers; | 3159 WebVector<uint32_t> documentMarkers; |
| 3158 m_webView->spellingMarkers(&documentMarkers); | 3160 m_webView->spellingMarkers(&documentMarkers); |
| 3159 EXPECT_EQ(0U, documentMarkers.size()); | 3161 EXPECT_EQ(0U, documentMarkers.size()); |
| 3160 | 3162 |
| 3161 m_webView->close(); | 3163 m_webView->close(); |
| 3162 m_webView = 0; | 3164 m_webView = 0; |
| 3163 } | 3165 } |
| 3164 | 3166 |
| 3167 // This test verifies that cancelling spelling request does not cause a |
| 3168 // write-after-free when there's no spellcheck client set. |
| 3169 TEST_F(WebFrameTest, CancelSpellingRequestCrash) |
| 3170 { |
| 3171 registerMockedHttpURLLoad("spell.html"); |
| 3172 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "spell.html")
; |
| 3173 m_webView->setSpellCheckClient(0); |
| 3174 |
| 3175 WebFrameImpl* frame = static_cast<WebFrameImpl*>(m_webView->mainFrame()); |
| 3176 Document* document = frame->frame()->document(); |
| 3177 Element* element = document->getElementById("data"); |
| 3178 |
| 3179 m_webView->settings()->setAsynchronousSpellCheckingEnabled(true); |
| 3180 m_webView->settings()->setUnifiedTextCheckerEnabled(true); |
| 3181 m_webView->settings()->setEditingBehavior(WebSettings::EditingBehaviorWin); |
| 3182 |
| 3183 element->focus(); |
| 3184 frame->frame()->editor()->replaceSelectionWithText("A", false, false); |
| 3185 frame->frame()->editor()->spellChecker()->cancelCheck(); |
| 3186 |
| 3187 m_webView->close(); |
| 3188 m_webView = 0; |
| 3189 } |
| 3190 |
| 3165 class TestAccessInitialDocumentWebFrameClient : public WebFrameClient { | 3191 class TestAccessInitialDocumentWebFrameClient : public WebFrameClient { |
| 3166 public: | 3192 public: |
| 3167 TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false
) | 3193 TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false
) |
| 3168 { | 3194 { |
| 3169 } | 3195 } |
| 3170 | 3196 |
| 3171 virtual void didAccessInitialDocument(WebFrame* frame) | 3197 virtual void didAccessInitialDocument(WebFrame* frame) |
| 3172 { | 3198 { |
| 3173 EXPECT_TRUE(!m_didAccessInitialDocument); | 3199 EXPECT_TRUE(!m_didAccessInitialDocument); |
| 3174 m_didAccessInitialDocument = true; | 3200 m_didAccessInitialDocument = true; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3408 frame->reload(); | 3434 frame->reload(); |
| 3409 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 3435 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| 3410 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().cachePolicy()); | 3436 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().cachePolicy()); |
| 3411 | 3437 |
| 3412 m_webView->close(); | 3438 m_webView->close(); |
| 3413 m_webView = 0; | 3439 m_webView = 0; |
| 3414 } | 3440 } |
| 3415 | 3441 |
| 3416 | 3442 |
| 3417 } // namespace | 3443 } // namespace |
| OLD | NEW |