diff options
| author | philipj@opera.com <philipj@opera.com> | 2015-05-20 14:10:16 +0000 |
|---|---|---|
| committer | philipj@opera.com <philipj@opera.com> | 2015-05-20 14:10:16 +0000 |
| commit | 7dfa3fd50c434913472ae720b0a5bc57f29ec113 (patch) | |
| tree | e27c9e03944754d6edcc79511cb0497f842b0a12 | |
| parent | d70ceaa2a0352fb869ea1b37ce9a1eb567d7dde2 (diff) | |
| download | chromium_src-7dfa3fd50c434913472ae720b0a5bc57f29ec113.zip chromium_src-7dfa3fd50c434913472ae720b0a5bc57f29ec113.tar.gz chromium_src-7dfa3fd50c434913472ae720b0a5bc57f29ec113.tar.bz2 | |
Remove the Document.charset setter (making it readonly)
Intent to Remove:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/vr1RANmrniU/oWAoayNP74QJ
HTMLFormControlElementTest and HTMLSelectElementTest don't actually need
to call Document::setCharset(), as they use APIs where the text has
already been decoded from UTF-8.
BUG=438392
Review URL: https://codereview.chromium.org/1145773003
git-svn-id: svn://svn.chromium.org/blink/trunk@195617 bbb929c8-8fbe-4397-9dbb-9b2b20218538
21 files changed, 12 insertions, 93 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Document/document-charset-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Document/document-charset-expected.txt index c4569e8..b76f473 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Document/document-charset-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Document/document-charset-expected.txt @@ -1,4 +1,3 @@ -CONSOLE WARNING: Setting 'Document.charset' is deprecated. Please use '<meta charset="UTF-8">' instead. Initial document.charset: KOI8-R @@ -9,22 +8,12 @@ Initial document.inputEncoding: KOI8-R -Setting charset to UTF-8... +Setting charset to UTF-8... (expected to have no effect) - document.charset: UTF-8 - - document.defaultCharset: defined - - document.characterSet: UTF-8 - - document.inputEncoding: UTF-8 - -Setting characterSet to KOI8-R (expected to fail, matching Firefox)... - - document.charset: UTF-8 + document.charset: KOI8-R document.defaultCharset: defined - document.characterSet: UTF-8 + document.characterSet: KOI8-R - document.inputEncoding: UTF-8 + document.inputEncoding: KOI8-R diff --git a/third_party/WebKit/LayoutTests/fast/dom/Document/document-charset.html b/third_party/WebKit/LayoutTests/fast/dom/Document/document-charset.html index fffc724..1594696 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Document/document-charset.html +++ b/third_party/WebKit/LayoutTests/fast/dom/Document/document-charset.html @@ -15,28 +15,12 @@ document.write("<p> document.defaultCharset: " + (document.defaultCharset ? document.write("<p> document.characterSet: " + document.characterSet + "</p>"); // Firefox document.write("<p> document.inputEncoding: " + document.inputEncoding + "</p>"); // DOM3 -document.write("<p>Setting charset to UTF-8...</p>"); -try { - document.charset = "utf-8"; - document.write("<p> document.charset: " + document.charset + "</p>"); - document.write("<p> document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>"); - document.write("<p> document.characterSet: " + document.characterSet + "</p>"); - document.write("<p> document.inputEncoding: " + document.inputEncoding + "</p>"); -} catch (ex) { - document.write("<p>Failure</p>"); -} - -// throws an exception in Firefox, but JavaScriptCore seems to silently ignore assignment to read-only properties -document.write("<p>Setting characterSet to KOI8-R (expected to fail, matching Firefox)...</p>"); -try { - document.characterSet = "KOI8-R"; - document.write("<p> document.charset: " + document.charset + "</p>"); - document.write("<p> document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>"); - document.write("<p> document.characterSet: " + document.characterSet + "</p>"); - document.write("<p> document.inputEncoding: " + document.inputEncoding + "</p>"); -} catch (ex) { - document.write("<p>Failure (expected)</p>"); -} +document.write("<p>Setting charset to UTF-8... (expected to have no effect)</p>"); +document.charset = "utf-8"; +document.write("<p> document.charset: " + document.charset + "</p>"); +document.write("<p> document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>"); +document.write("<p> document.characterSet: " + document.characterSet + "</p>"); +document.write("<p> document.inputEncoding: " + document.inputEncoding + "</p>"); </script> </body> diff --git a/third_party/WebKit/LayoutTests/fast/dom/frame-loading-via-document-write-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/frame-loading-via-document-write-expected.txt index e1db80e..5b69cb1 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/frame-loading-via-document-write-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/frame-loading-via-document-write-expected.txt @@ -1,4 +1,3 @@ -CONSOLE WARNING: Setting 'Document.charset' is deprecated. Please use '<meta charset="UTF-8">' instead. -------- diff --git a/third_party/WebKit/LayoutTests/fast/dom/frame-loading-via-document-write.html b/third_party/WebKit/LayoutTests/fast/dom/frame-loading-via-document-write.html index bb10672..cfa8008 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/frame-loading-via-document-write.html +++ b/third_party/WebKit/LayoutTests/fast/dom/frame-loading-via-document-write.html @@ -28,7 +28,6 @@ function buildFrameset() "</td></tr></table></body></html>"; frames['topRow'].document.open("text/html","replace"); - frames['topRow'].document.charset=document.charset; frames['topRow'].document.write(outHTML); frames['topRow'].document.close(); @@ -45,7 +44,6 @@ function buildFrameset() "</td></tr></table></body></html>"; frames['middleRow'].document.open("text/html","replace"); - frames['middleRow'].document.charset=document.charset; frames['middleRow'].document.write(outHTML); frames['middleRow'].document.close(); @@ -56,7 +54,6 @@ function buildFrameset() "</td></tr></table></body></html>"; frames['bottomRow'].document.open("text/html","replace"); - frames['bottomRow'].document.charset=document.charset; frames['bottomRow'].document.write(outHTML); frames['bottomRow'].document.close(); } diff --git a/third_party/WebKit/LayoutTests/fast/encoding/css-charset-default-expected.txt b/third_party/WebKit/LayoutTests/fast/encoding/css-charset-default-expected.txt index 1248b07..46ffa35 100644 --- a/third_party/WebKit/LayoutTests/fast/encoding/css-charset-default-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/encoding/css-charset-default-expected.txt @@ -1,4 +1,3 @@ -CONSOLE WARNING: Setting 'Document.charset' is deprecated. Please use '<meta charset="UTF-8">' instead. Test for bug 11011: External CSS is parsed as iso-8859-1 even though the main document is utf-8. Stylesheet 1 (inherit document charset using xml-stylesheet processing instruction): "SUССЕSS" @@ -8,5 +7,3 @@ Stylesheet 2 (inherit document charset using link): "SUССЕSS" Stylesheet 3 (inherit referring stylesheet charset): "SUССЕSS" Stylesheet 4 (inherit referring inline stylesheet charset): "SUССЕSS" - -Stylesheet 5 (inherit document charset using link after document.charset was set): "SUССЕSS" diff --git a/third_party/WebKit/LayoutTests/fast/encoding/css-charset-default.xhtml b/third_party/WebKit/LayoutTests/fast/encoding/css-charset-default.xhtml index 42484c85..67de026 100644 --- a/third_party/WebKit/LayoutTests/fast/encoding/css-charset-default.xhtml +++ b/third_party/WebKit/LayoutTests/fast/encoding/css-charset-default.xhtml @@ -10,8 +10,6 @@ <style type="text/css"> @import "css-charset-inherit-iso-8859-5.css?4"; </style> - <script>document.charset = "koi8-r";</script> - <link rel="stylesheet" type="text/css" href="css-charset-inherit-koi-8.css?2"/> </head> <body onload="test()"> <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=11011">bug 11011</a>: @@ -21,7 +19,6 @@ External CSS is parsed as iso-8859-1 even though the main document is utf-8.</p> <p id="res2">Stylesheet 2 (inherit document charset using link): </p> <p id="res3">Stylesheet 3 (inherit referring stylesheet charset): </p> <p id="res4">Stylesheet 4 (inherit referring inline stylesheet charset): </p> -<p id="res5">Stylesheet 5 (inherit document charset using link after document.charset was set): </p> <script type="text/javascript"> if (window.testRunner) @@ -36,8 +33,6 @@ function test() { document.getElementById("res3").innerHTML += document.styleSheets[2].cssRules[0].styleSheet.cssRules[0].style.content; document.getElementById("res4").innerHTML += document.styleSheets[3].cssRules[0].styleSheet.cssRules[0].style.content; - - document.getElementById("res5").innerHTML += document.styleSheets[4].cssRules[0].style.content; } catch (ex) { alert(ex.toString()); } diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt index ef69cf5..7a01574 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt @@ -880,7 +880,6 @@ interface Document method webkitCancelFullScreen method webkitExitFullscreen setter body - setter charset setter cookie setter designMode setter dir diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index e7e86e5..2cb06d2 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt @@ -1143,7 +1143,6 @@ interface Document method webkitCancelFullScreen method webkitExitFullscreen setter body - setter charset setter cookie setter designMode setter dir diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 605ea63..eccc2c9 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp @@ -1131,20 +1131,6 @@ String Document::defaultCharset() const return String(); } -void Document::setCharset(const String& charset) -{ - UseCounter::countDeprecation(*this, UseCounter::DocumentSetCharset); - if (DocumentLoader* documentLoader = loader()) - documentLoader->setUserChosenEncoding(charset); - WTF::TextEncoding encoding(charset); - // In case the encoding didn't exist, we keep the old one (helps some sites specifying invalid encodings). - if (!encoding.isValid()) - return; - DocumentEncodingData newEncodingData = m_encodingData; - newEncodingData.setEncoding(encoding); - setEncodingData(newEncodingData); -} - void Document::setContentLanguage(const AtomicString& language) { if (m_contentLanguage == language) diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h index 46f2243..ee9d577 100644 --- a/third_party/WebKit/Source/core/dom/Document.h +++ b/third_party/WebKit/Source/core/dom/Document.h @@ -327,8 +327,6 @@ public: AtomicString encodingName() const; - void setCharset(const String&); - void setContent(const String&); String suggestedMIMEType() const; diff --git a/third_party/WebKit/Source/core/dom/Document.idl b/third_party/WebKit/Source/core/dom/Document.idl index bcd9d99..ab66f67 100644 --- a/third_party/WebKit/Source/core/dom/Document.idl +++ b/third_party/WebKit/Source/core/dom/Document.idl @@ -199,7 +199,7 @@ interface Document : Node { readonly attribute VisibilityState visibilityState; // Non-standard APIs - [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset; + [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString charset; [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset; [MeasureAs=DocumentCaretRangeFromPoint] Range caretRangeFromPoint([Default=Undefined] optional long x, [Default=Undefined] optional long y); [DeprecateAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); diff --git a/third_party/WebKit/Source/core/frame/UseCounter.cpp b/third_party/WebKit/Source/core/frame/UseCounter.cpp index 567d022..3c734e6 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.cpp +++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp @@ -827,9 +827,6 @@ String UseCounter::deprecationMessage(Feature feature) case GetMatchedCSSRules: return "'getMatchedCSSRules()' is deprecated. For more help, check https://code.google.com/p/chromium/issues/detail?id=437569#c2"; - case DocumentSetCharset: - return "Setting 'Document.charset' is deprecated. Please use '<meta charset=\"UTF-8\">' instead."; - case PrefixedImageSmoothingEnabled: return replacedBy("CanvasRenderingContext2D.webkitImageSmoothingEnabled", "CanvasRenderingContext2D.imageSmoothingEnabled"); diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h index e19e0b7..5d49591 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.h +++ b/third_party/WebKit/Source/core/frame/UseCounter.h @@ -364,7 +364,6 @@ public: DocumentPointerLockElement = 422, PrefixedCursorZoomIn = 424, PrefixedCursorZoomOut = 425, - DocumentSetCharset = 427, DocumentDefaultCharset = 428, TextEncoderConstructor = 429, TextEncoderEncode = 430, diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp index af4caac..9ead112 100644 --- a/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFormControlElementTest.cpp @@ -35,7 +35,6 @@ void HTMLFormControlElementTest::SetUp() m_document = toHTMLDocument(&m_dummyPageHolder->document()); m_document->setMimeType("text/html"); - m_document->setCharset("utf-8"); } TEST_F(HTMLFormControlElementTest, customValidationMessageTextDirection) diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp index 6ea3101..b39245d 100644 --- a/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp +++ b/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp @@ -32,7 +32,6 @@ void HTMLSelectElementTest::SetUp() m_document = toHTMLDocument(&m_dummyPageHolder->document()); m_document->setMimeType("text/html"); - m_document->setCharset("utf-8"); } TEST_F(HTMLSelectElementTest, SaveRestoreSelectSingleFormControlState) diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp index d30ab51..7c48353 100644 --- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp +++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp @@ -330,7 +330,7 @@ bool TextResourceDecoder::checkForXMLCharset(const char* data, size_t len, bool& void TextResourceDecoder::checkForMetaCharset(const char* data, size_t length) { - if (m_source == UserChosenEncoding || m_source == EncodingFromHTTPHeader || m_source == AutoDetectedEncoding) { + if (m_source == EncodingFromHTTPHeader || m_source == AutoDetectedEncoding) { m_checkedForMetaCharset = true; return; } diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h index ebbd774..e689c2e 100644 --- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h +++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h @@ -41,7 +41,6 @@ public: EncodingFromMetaTag, EncodingFromCSSCharset, EncodingFromHTTPHeader, - UserChosenEncoding, EncodingFromParentFrame }; diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp index 2980d06..a7cefb6 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp @@ -766,12 +766,6 @@ const AtomicString& DocumentLoader::mimeType() const return m_response.mimeType(); } -void DocumentLoader::setUserChosenEncoding(const String& charset) -{ - if (m_writer) - m_writer->setUserChosenEncoding(charset); -} - // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptURL() void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentInit& init, const String& source, Document* ownerDocument) { diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.h b/third_party/WebKit/Source/core/loader/DocumentLoader.h index 4af593e..571a61cf 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.h +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.h @@ -76,8 +76,6 @@ namespace blink { const AtomicString& mimeType() const; - void setUserChosenEncoding(const String& charset); - const ResourceRequest& originalRequest() const; const ResourceRequest& request() const; diff --git a/third_party/WebKit/Source/core/loader/DocumentWriter.cpp b/third_party/WebKit/Source/core/loader/DocumentWriter.cpp index 622dc6f..f85252e 100644 --- a/third_party/WebKit/Source/core/loader/DocumentWriter.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentWriter.cpp @@ -119,13 +119,6 @@ void DocumentWriter::end() m_document = nullptr; } -void DocumentWriter::setUserChosenEncoding(const String& charset) -{ - TextResourceDecoder* decoder = m_parser->decoder(); - if (decoder) - decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); -} - void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() { ASSERT(m_parser && !m_parser->isStopped()); diff --git a/third_party/WebKit/Source/core/loader/DocumentWriter.h b/third_party/WebKit/Source/core/loader/DocumentWriter.h index c0918dd..08024ca 100644 --- a/third_party/WebKit/Source/core/loader/DocumentWriter.h +++ b/third_party/WebKit/Source/core/loader/DocumentWriter.h @@ -58,8 +58,6 @@ public: // Exposed for DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL. void appendReplacingData(const String&); - void setUserChosenEncoding(const String& charset); - void setDocumentWasLoadedAsPartOfNavigation(); private: |
