From: japhet@chromium.org Date: Tue, 3 Jul 2012 23:54:03 +0000 (+0000) Subject: Source/WebCore: REGRESSION (r115654): Sometimes does not replace content for multipar... X-Git-Tag: 070512121124~85 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be0cdfcb41e9c36b0c70e648208226bb50cf0825;p=profile%2Fivi%2Fwebkit-efl.git Source/WebCore: REGRESSION (r115654): Sometimes does not replace content for multipart/x-mixed-replace https://bugs.webkit.org/show_bug.cgi?id=88436 Reviewed by Brady Eidson. Test: http/tests/multipart/multipart-replace-non-html-content.php * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::commitData): We should only send receivedFirstData() once per main resource load, rather than multiple times in a multipart load. (WebCore::DocumentLoader::setupForReplaceByMIMEType): m_gotFirstByte isn't set to true until data is actually committed, and multipart data is often not committed until the part is finished. Check whether the SharedBuffer is non-null instead. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::resetInternalsObject): The JSInternals object my have already been cleared if the window shell was cleared as part of creation of a new Document. Check it before using it. LayoutTests: Test for https://bugs.webkit.org/show_bug.cgi?id=88436. Reviewed by Brady Eidson. * http/tests/multipart/multipart-replace-non-html-content-expected.txt: Added. * http/tests/multipart/multipart-replace-non-html-content.php: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121813 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 9dc24d5..e5e3425 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,12 @@ +2012-07-03 Nate Chapin + + Test for https://bugs.webkit.org/show_bug.cgi?id=88436. + + Reviewed by Brady Eidson. + + * http/tests/multipart/multipart-replace-non-html-content-expected.txt: Added. + * http/tests/multipart/multipart-replace-non-html-content.php: Added. + 2012-07-03 Emil A Eklund Unreviewed chromium mac rebaselines. diff --git a/LayoutTests/http/tests/multipart/multipart-replace-non-html-content-expected.txt b/LayoutTests/http/tests/multipart/multipart-replace-non-html-content-expected.txt new file mode 100644 index 0000000..746bac8 --- /dev/null +++ b/LayoutTests/http/tests/multipart/multipart-replace-non-html-content-expected.txt @@ -0,0 +1,3 @@ +This text should only appear once 10 + + diff --git a/LayoutTests/http/tests/multipart/multipart-replace-non-html-content.php b/LayoutTests/http/tests/multipart/multipart-replace-non-html-content.php new file mode 100644 index 0000000..3890cb8 --- /dev/null +++ b/LayoutTests/http/tests/multipart/multipart-replace-non-html-content.php @@ -0,0 +1,26 @@ + + + + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 213399d..ec5c30c 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2012-07-03 Nate Chapin + + REGRESSION (r115654): Sometimes does not replace content for multipart/x-mixed-replace + https://bugs.webkit.org/show_bug.cgi?id=88436 + + Reviewed by Brady Eidson. + + Test: http/tests/multipart/multipart-replace-non-html-content.php + + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::commitData): We should only send receivedFirstData() once per main resource load, + rather than multiple times in a multipart load. + (WebCore::DocumentLoader::setupForReplaceByMIMEType): m_gotFirstByte isn't set to true until data is + actually committed, and multipart data is often not committed until the part is finished. Check + whether the SharedBuffer is non-null instead. + * testing/js/WebCoreTestSupport.cpp: + (WebCoreTestSupport::resetInternalsObject): The JSInternals object my have already been cleared if the window shell + was cleared as part of creation of a new Document. Check it before using it. + 2012-07-03 Raymond Toy Add AudioFIFO class and simplify AudioPullFIFO diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp index 302a7ad..bf6cb9e 100644 --- a/Source/WebCore/loader/DocumentLoader.cpp +++ b/Source/WebCore/loader/DocumentLoader.cpp @@ -335,7 +335,8 @@ void DocumentLoader::commitData(const char* bytes, size_t length) m_frame->document()->setBaseURLOverride(m_archive->mainResource()->url()); #endif - frameLoader()->receivedFirstData(); + if (!frameLoader()->isReplacing()) + frameLoader()->receivedFirstData(); bool userChosen = true; String encoding = overrideEncoding(); @@ -366,7 +367,7 @@ void DocumentLoader::receivedData(const char* data, int length) void DocumentLoader::setupForReplaceByMIMEType(const String& newMIMEType) { - if (!m_gotFirstByte) + if (!mainResourceData()) return; String oldMIMEType = m_response.mimeType(); diff --git a/Source/WebCore/testing/js/WebCoreTestSupport.cpp b/Source/WebCore/testing/js/WebCoreTestSupport.cpp index f36e4a0..cfb93874 100644 --- a/Source/WebCore/testing/js/WebCoreTestSupport.cpp +++ b/Source/WebCore/testing/js/WebCoreTestSupport.cpp @@ -52,8 +52,10 @@ void resetInternalsObject(JSContextRef context) ExecState* exec = toJS(context); JSLockHolder lock(exec); JSDOMGlobalObject* globalObject = jsCast(exec->lexicalGlobalObject()); - Internals * internals = toInternals(globalObject->getDirect(exec->globalData(), Identifier(exec, Internals::internalsId))); - if (internals) { + JSValue internalsJS = globalObject->getDirect(exec->globalData(), Identifier(exec, Internals::internalsId)); + if (internalsJS.isNull() || internalsJS.isEmpty()) + return; + if (Internals* internals = toInternals(internalsJS)) { ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); if (scriptContext->isDocument()) internals->reset(static_cast(scriptContext));