<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[236058] releases/WebKitGTK/webkit-2.22/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/236058">236058</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2018-09-17 05:03:12 -0700 (Mon, 17 Sep 2018)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/235355">r235355</a> - Shrink size of XMLHttpRequest
https://bugs.webkit.org/show_bug.cgi?id=188944

Reviewed by Saam Barati.

Source/WebCore:

Shrink the size of XMLHttpRequest by packing bits and reordering members.
It reduces the size from 1248 to 1176.

No behavior change.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::XMLHttpRequest):
(WebCore::XMLHttpRequest::responseText):
(WebCore::XMLHttpRequest::createResponseBlob):
(WebCore::XMLHttpRequest::createResponseArrayBuffer):
(WebCore::XMLHttpRequest::setResponseType):
(WebCore::XMLHttpRequest::changeState):
(WebCore::XMLHttpRequest::callReadyStateChangeListener):
(WebCore::XMLHttpRequest::setWithCredentials):
(WebCore::XMLHttpRequest::open):
(WebCore::XMLHttpRequest::prepareToSend):
(WebCore::XMLHttpRequest::createRequest):
(WebCore::XMLHttpRequest::abort):
(WebCore::XMLHttpRequest::overrideMimeType):
(WebCore::XMLHttpRequest::setRequestHeader):
(WebCore::XMLHttpRequest::getAllResponseHeaders const):
(WebCore::XMLHttpRequest::getResponseHeader const):
(WebCore::XMLHttpRequest::status const):
(WebCore::XMLHttpRequest::statusText const):
(WebCore::XMLHttpRequest::didFinishLoading):
(WebCore::XMLHttpRequest::createDecoder const):
(WebCore::XMLHttpRequest::didReceiveData):
(WebCore::XMLHttpRequest::didReachTimeout):
(WebCore::XMLHttpRequest::readyState const): Deleted.
* xml/XMLHttpRequest.h:
(WebCore::XMLHttpRequest::responseType const):
(WebCore::XMLHttpRequest::readyState const):
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle):
* xml/XMLHttpRequestProgressEventThrottle.h:

Source/WTF:

StringBuilder is included in XMLHttpRequest. We reduce the size of StringBuilder too
by reordering members.

* wtf/text/StringBuilder.h:
(WTF::StringBuilder::StringBuilder):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit222SourceWTFChangeLog">releases/WebKitGTK/webkit-2.22/Source/WTF/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit222SourceWTFwtftextStringBuilderh">releases/WebKitGTK/webkit-2.22/Source/WTF/wtf/text/StringBuilder.h</a></li>
<li><a href="#releasesWebKitGTKwebkit222SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit222SourceWebCorexmlXMLHttpRequestcpp">releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit222SourceWebCorexmlXMLHttpRequesth">releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequest.h</a></li>
<li><a href="#releasesWebKitGTKwebkit222SourceWebCorexmlXMLHttpRequestProgressEventThrottlecpp">releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit222SourceWebCorexmlXMLHttpRequestProgressEventThrottleh">releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit222SourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.22/Source/WTF/ChangeLog (236057 => 236058)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.22/Source/WTF/ChangeLog      2018-09-17 12:03:03 UTC (rev 236057)
+++ releases/WebKitGTK/webkit-2.22/Source/WTF/ChangeLog 2018-09-17 12:03:12 UTC (rev 236058)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2018-08-25  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
+
+        Shrink size of XMLHttpRequest
+        https://bugs.webkit.org/show_bug.cgi?id=188944
+
+        Reviewed by Saam Barati.
+
+        StringBuilder is included in XMLHttpRequest. We reduce the size of StringBuilder too
+        by reordering members.
+
+        * wtf/text/StringBuilder.h:
+        (WTF::StringBuilder::StringBuilder):
+
</ins><span class="cx"> 2018-08-24  Tim Horton  <timothy_horton@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Improve unified source generator script logging and error messages
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit222SourceWTFwtftextStringBuilderh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.22/Source/WTF/wtf/text/StringBuilder.h (236057 => 236058)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.22/Source/WTF/wtf/text/StringBuilder.h       2018-09-17 12:03:03 UTC (rev 236057)
+++ releases/WebKitGTK/webkit-2.22/Source/WTF/wtf/text/StringBuilder.h  2018-09-17 12:03:12 UTC (rev 236058)
</span><span class="lines">@@ -40,9 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     StringBuilder()
</span><del>-        : m_length(0)
-        , m_is8Bit(true)
-        , m_bufferCharacters8(nullptr)
</del><ins>+        : m_bufferCharacters8(nullptr)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx">     StringBuilder(StringBuilder&&) = default;
</span><span class="lines">@@ -308,14 +306,14 @@
</span><span class="cx">     ALWAYS_INLINE CharType * getBufferCharacters();
</span><span class="cx">     WTF_EXPORT_PRIVATE void reifyString() const;
</span><span class="cx"> 
</span><del>-    unsigned m_length;
</del><span class="cx">     mutable String m_string;
</span><span class="cx">     RefPtr<StringImpl> m_buffer;
</span><del>-    bool m_is8Bit;
</del><span class="cx">     union {
</span><span class="cx">         LChar* m_bufferCharacters8;
</span><span class="cx">         UChar* m_bufferCharacters16;
</span><span class="cx">     };
</span><ins>+    unsigned m_length { 0 };
+    bool m_is8Bit { true };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template <>
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit222SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog (236057 => 236058)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog  2018-09-17 12:03:03 UTC (rev 236057)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/ChangeLog     2018-09-17 12:03:12 UTC (rev 236058)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2018-08-25  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
+
+        Shrink size of XMLHttpRequest
+        https://bugs.webkit.org/show_bug.cgi?id=188944
+
+        Reviewed by Saam Barati.
+
+        Shrink the size of XMLHttpRequest by packing bits and reordering members.
+        It reduces the size from 1248 to 1176.
+
+        No behavior change.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::XMLHttpRequest):
+        (WebCore::XMLHttpRequest::responseText):
+        (WebCore::XMLHttpRequest::createResponseBlob):
+        (WebCore::XMLHttpRequest::createResponseArrayBuffer):
+        (WebCore::XMLHttpRequest::setResponseType):
+        (WebCore::XMLHttpRequest::changeState):
+        (WebCore::XMLHttpRequest::callReadyStateChangeListener):
+        (WebCore::XMLHttpRequest::setWithCredentials):
+        (WebCore::XMLHttpRequest::open):
+        (WebCore::XMLHttpRequest::prepareToSend):
+        (WebCore::XMLHttpRequest::createRequest):
+        (WebCore::XMLHttpRequest::abort):
+        (WebCore::XMLHttpRequest::overrideMimeType):
+        (WebCore::XMLHttpRequest::setRequestHeader):
+        (WebCore::XMLHttpRequest::getAllResponseHeaders const):
+        (WebCore::XMLHttpRequest::getResponseHeader const):
+        (WebCore::XMLHttpRequest::status const):
+        (WebCore::XMLHttpRequest::statusText const):
+        (WebCore::XMLHttpRequest::didFinishLoading):
+        (WebCore::XMLHttpRequest::createDecoder const):
+        (WebCore::XMLHttpRequest::didReceiveData):
+        (WebCore::XMLHttpRequest::didReachTimeout):
+        (WebCore::XMLHttpRequest::readyState const): Deleted.
+        * xml/XMLHttpRequest.h:
+        (WebCore::XMLHttpRequest::responseType const):
+        (WebCore::XMLHttpRequest::readyState const):
+        * xml/XMLHttpRequestProgressEventThrottle.cpp:
+        (WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle):
+        * xml/XMLHttpRequestProgressEventThrottle.h:
+
</ins><span class="cx"> 2018-08-26  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Make IDBCursor::m_request a WeakPtr
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit222SourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequest.cpp (236057 => 236058)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequest.cpp     2018-09-17 12:03:03 UTC (rev 236057)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequest.cpp        2018-09-17 12:03:12 UTC (rev 236058)
</span><span class="lines">@@ -111,6 +111,18 @@
</span><span class="cx"> 
</span><span class="cx"> XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext& context)
</span><span class="cx">     : ActiveDOMObject(&context)
</span><ins>+    , m_async(true)
+    , m_includeCredentials(false)
+    , m_sendFlag(false)
+    , m_createdDocument(false)
+    , m_error(false)
+    , m_uploadListenerFlag(false)
+    , m_uploadComplete(false)
+    , m_wasAbortedByClient(false)
+    , m_responseCacheIsValid(false)
+    , m_dispatchErrorOnResuming(false)
+    , m_readyState(static_cast<unsigned>(UNSENT))
+    , m_responseType(static_cast<unsigned>(ResponseType::EmptyString))
</ins><span class="cx">     , m_progressEventThrottle(this)
</span><span class="cx">     , m_resumeTimer(*this, &XMLHttpRequest::resumeTimerFired)
</span><span class="cx">     , m_networkErrorTimer(*this, &XMLHttpRequest::networkErrorTimerFired)
</span><span class="lines">@@ -150,14 +162,9 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-XMLHttpRequest::State XMLHttpRequest::readyState() const
-{
-    return m_state;
-}
-
</del><span class="cx"> ExceptionOr<OwnedString> XMLHttpRequest::responseText()
</span><span class="cx"> {
</span><del>-    if (m_responseType != ResponseType::EmptyString && m_responseType != ResponseType::Text)
</del><ins>+    if (responseType() != ResponseType::EmptyString && responseType() != ResponseType::Text)
</ins><span class="cx">         return Exception { InvalidStateError };
</span><span class="cx">     return OwnedString { responseTextIgnoringResponseType() };
</span><span class="cx"> }
</span><span class="lines">@@ -173,7 +180,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(scriptExecutionContext()->isDocument());
</span><span class="cx">     
</span><del>-    if (m_responseType != ResponseType::EmptyString && m_responseType != ResponseType::Document)
</del><ins>+    if (responseType() != ResponseType::EmptyString && responseType() != ResponseType::Document)
</ins><span class="cx">         return Exception { InvalidStateError };
</span><span class="cx"> 
</span><span class="cx">     if (!doneWithoutErrors())
</span><span class="lines">@@ -186,7 +193,7 @@
</span><span class="cx">         // The W3C spec requires the final MIME type to be some valid XML type, or text/html.
</span><span class="cx">         // If it is text/html, then the responseType of "document" must have been supplied explicitly.
</span><span class="cx">         if ((m_response.isHTTP() && !responseIsXML() && !isHTML)
</span><del>-            || (isHTML && m_responseType == ResponseType::EmptyString)) {
</del><ins>+            || (isHTML && responseType() == ResponseType::EmptyString)) {
</ins><span class="cx">             m_responseDocument = nullptr;
</span><span class="cx">         } else {
</span><span class="cx">             if (isHTML)
</span><span class="lines">@@ -210,7 +217,7 @@
</span><span class="cx"> 
</span><span class="cx"> Ref<Blob> XMLHttpRequest::createResponseBlob()
</span><span class="cx"> {
</span><del>-    ASSERT(m_responseType == ResponseType::Blob);
</del><ins>+    ASSERT(responseType() == ResponseType::Blob);
</ins><span class="cx">     ASSERT(doneWithoutErrors());
</span><span class="cx"> 
</span><span class="cx">     if (!m_binaryResponseBuilder)
</span><span class="lines">@@ -226,7 +233,7 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr<ArrayBuffer> XMLHttpRequest::createResponseArrayBuffer()
</span><span class="cx"> {
</span><del>-    ASSERT(m_responseType == ResponseType::Arraybuffer);
</del><ins>+    ASSERT(responseType() == ResponseType::Arraybuffer);
</ins><span class="cx">     ASSERT(doneWithoutErrors());
</span><span class="cx"> 
</span><span class="cx">     auto result = m_binaryResponseBuilder ? m_binaryResponseBuilder->tryCreateArrayBuffer() : ArrayBuffer::create(nullptr, 0);
</span><span class="lines">@@ -255,7 +262,7 @@
</span><span class="cx">     if (!scriptExecutionContext()->isDocument() && type == ResponseType::Document)
</span><span class="cx">         return { };
</span><span class="cx"> 
</span><del>-    if (m_state >= LOADING)
</del><ins>+    if (readyState() >= LOADING)
</ins><span class="cx">         return Exception { InvalidStateError };
</span><span class="cx"> 
</span><span class="cx">     // Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated
</span><span class="lines">@@ -267,7 +274,7 @@
</span><span class="cx">         return Exception { InvalidAccessError };
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_responseType = type;
</del><ins>+    m_responseType = static_cast<unsigned>(type);
</ins><span class="cx">     return { };
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -288,8 +295,8 @@
</span><span class="cx"> 
</span><span class="cx"> void XMLHttpRequest::changeState(State newState)
</span><span class="cx"> {
</span><del>-    if (m_state != newState) {
-        m_state = newState;
</del><ins>+    if (readyState() != newState) {
+        m_readyState = static_cast<State>(newState);
</ins><span class="cx">         callReadyStateChangeListener();
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -299,12 +306,12 @@
</span><span class="cx">     if (!scriptExecutionContext())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // Check whether sending load and loadend events before sending readystatechange event, as it may change m_error/m_state values.
-    bool shouldSendLoadEvent = (m_state == DONE && !m_error);
</del><ins>+    // Check whether sending load and loadend events before sending readystatechange event, as it may change m_error/m_readyState values.
+    bool shouldSendLoadEvent = (readyState() == DONE && !m_error);
</ins><span class="cx"> 
</span><del>-    if (m_async || (m_state <= OPENED || m_state == DONE)) {
</del><ins>+    if (m_async || (readyState() <= OPENED || readyState() == DONE)) {
</ins><span class="cx">         m_progressEventThrottle.dispatchReadyStateChangeEvent(Event::create(eventNames().readystatechangeEvent, Event::CanBubble::No, Event::IsCancelable::No),
</span><del>-            m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
</del><ins>+            readyState() == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (shouldSendLoadEvent) {
</span><span class="lines">@@ -315,7 +322,7 @@
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> XMLHttpRequest::setWithCredentials(bool value)
</span><span class="cx"> {
</span><del>-    if (m_state > OPENED || m_sendFlag)
</del><ins>+    if (readyState() > OPENED || m_sendFlag)
</ins><span class="cx">         return Exception { InvalidStateError };
</span><span class="cx"> 
</span><span class="cx">     m_includeCredentials = value;
</span><span class="lines">@@ -341,7 +348,7 @@
</span><span class="cx">         // attempt to discourage synchronous XHR use. responseType is one such piece of functionality.
</span><span class="cx">         // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols
</span><span class="cx">         // such as file: and data: still make sense to allow.
</span><del>-        if (url.protocolIsInHTTPFamily() && m_responseType != ResponseType::EmptyString) {
</del><ins>+        if (url.protocolIsInHTTPFamily() && responseType() != ResponseType::EmptyString) {
</ins><span class="cx">             logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set.");
</span><span class="cx">             return Exception { InvalidAccessError };
</span><span class="cx">         }
</span><span class="lines">@@ -401,7 +408,7 @@
</span><span class="cx"> 
</span><span class="cx">     auto& context = *scriptExecutionContext();
</span><span class="cx"> 
</span><del>-    if (m_state != OPENED || m_sendFlag)
</del><ins>+    if (readyState() != OPENED || m_sendFlag)
</ins><span class="cx">         return ExceptionOr<void> { Exception { InvalidStateError } };
</span><span class="cx">     ASSERT(!m_loader);
</span><span class="cx"> 
</span><span class="lines">@@ -613,7 +620,7 @@
</span><span class="cx">         if (!m_uploadComplete && m_uploadListenerFlag)
</span><span class="cx">             m_upload->dispatchProgressEvent(eventNames().loadstartEvent);
</span><span class="cx"> 
</span><del>-        if (m_state != OPENED || !m_sendFlag || m_loader)
</del><ins>+        if (readyState() != OPENED || !m_sendFlag || m_loader)
</ins><span class="cx">             return { };
</span><span class="cx"> 
</span><span class="cx">         // ThreadableLoader::create can return null here, for example if we're no longer attached to a page or if a content blocker blocks the load.
</span><span class="lines">@@ -655,14 +662,14 @@
</span><span class="cx">     clearResponseBuffers();
</span><span class="cx"> 
</span><span class="cx">     m_requestHeaders.clear();
</span><del>-    if ((m_state == OPENED && m_sendFlag) || m_state == HEADERS_RECEIVED || m_state == LOADING) {
</del><ins>+    if ((readyState() == OPENED && m_sendFlag) || readyState() == HEADERS_RECEIVED || readyState() == LOADING) {
</ins><span class="cx">         ASSERT(!m_loader);
</span><span class="cx">         m_sendFlag = false;
</span><span class="cx">         changeState(DONE);
</span><span class="cx">         dispatchErrorEvents(eventNames().abortEvent);
</span><span class="cx">     }
</span><del>-    if (m_state == DONE)
-        m_state = UNSENT;
</del><ins>+    if (readyState() == DONE)
+        m_readyState = static_cast<State>(UNSENT);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool XMLHttpRequest::internalAbort()
</span><span class="lines">@@ -767,7 +774,7 @@
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> XMLHttpRequest::overrideMimeType(const String& override)
</span><span class="cx"> {
</span><del>-    if (m_state == LOADING || m_state == DONE)
</del><ins>+    if (readyState() == LOADING || readyState() == DONE)
</ins><span class="cx">         return Exception { InvalidStateError };
</span><span class="cx"> 
</span><span class="cx">     m_mimeTypeOverride = override;
</span><span class="lines">@@ -776,7 +783,7 @@
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr<void> XMLHttpRequest::setRequestHeader(const String& name, const String& value)
</span><span class="cx"> {
</span><del>-    if (m_state != OPENED || m_sendFlag) {
</del><ins>+    if (readyState() != OPENED || m_sendFlag) {
</ins><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx">         if (usesDashboardBackwardCompatibilityMode())
</span><span class="cx">             return { };
</span><span class="lines">@@ -805,7 +812,7 @@
</span><span class="cx"> 
</span><span class="cx"> String XMLHttpRequest::getAllResponseHeaders() const
</span><span class="cx"> {
</span><del>-    if (m_state < HEADERS_RECEIVED || m_error)
</del><ins>+    if (readyState() < HEADERS_RECEIVED || m_error)
</ins><span class="cx">         return emptyString();
</span><span class="cx"> 
</span><span class="cx">     if (!m_allResponseHeaders) {
</span><span class="lines">@@ -833,7 +840,7 @@
</span><span class="cx"> 
</span><span class="cx"> String XMLHttpRequest::getResponseHeader(const String& name) const
</span><span class="cx"> {
</span><del>-    if (m_state < HEADERS_RECEIVED || m_error)
</del><ins>+    if (readyState() < HEADERS_RECEIVED || m_error)
</ins><span class="cx">         return String();
</span><span class="cx"> 
</span><span class="cx">     return m_response.httpHeaderField(name);
</span><span class="lines">@@ -860,7 +867,7 @@
</span><span class="cx"> 
</span><span class="cx"> int XMLHttpRequest::status() const
</span><span class="cx"> {
</span><del>-    if (m_state == UNSENT || m_state == OPENED || m_error)
</del><ins>+    if (readyState() == UNSENT || readyState() == OPENED || m_error)
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     return m_response.httpStatusCode();
</span><span class="lines">@@ -868,7 +875,7 @@
</span><span class="cx"> 
</span><span class="cx"> String XMLHttpRequest::statusText() const
</span><span class="cx"> {
</span><del>-    if (m_state == UNSENT || m_state == OPENED || m_error)
</del><ins>+    if (readyState() == UNSENT || readyState() == OPENED || m_error)
</ins><span class="cx">         return String();
</span><span class="cx"> 
</span><span class="cx">     return m_response.httpStatusText();
</span><span class="lines">@@ -910,7 +917,7 @@
</span><span class="cx">     if (m_error)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (m_state < HEADERS_RECEIVED)
</del><ins>+    if (readyState() < HEADERS_RECEIVED)
</ins><span class="cx">         changeState(HEADERS_RECEIVED);
</span><span class="cx"> 
</span><span class="cx">     if (m_decoder)
</span><span class="lines">@@ -977,7 +984,7 @@
</span><span class="cx">     if (!m_responseEncoding.isEmpty())
</span><span class="cx">         return TextResourceDecoder::create("text/plain", m_responseEncoding);
</span><span class="cx"> 
</span><del>-    switch (m_responseType) {
</del><ins>+    switch (responseType()) {
</ins><span class="cx">     case ResponseType::EmptyString:
</span><span class="cx">         if (responseIsXML()) {
</span><span class="cx">             auto decoder = TextResourceDecoder::create("application/xml");
</span><span class="lines">@@ -1010,7 +1017,7 @@
</span><span class="cx">     if (m_error)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (m_state < HEADERS_RECEIVED)
</del><ins>+    if (readyState() < HEADERS_RECEIVED)
</ins><span class="cx">         changeState(HEADERS_RECEIVED);
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Should we update "Content-Type" header field with m_mimeTypeOverride value in case it has changed since didReceiveResponse?
</span><span class="lines">@@ -1019,7 +1026,7 @@
</span><span class="cx">     if (m_responseEncoding.isEmpty())
</span><span class="cx">         m_responseEncoding = m_response.textEncodingName();
</span><span class="cx"> 
</span><del>-    bool useDecoder = shouldDecodeResponse(m_responseType);
</del><ins>+    bool useDecoder = shouldDecodeResponse(responseType());
</ins><span class="cx"> 
</span><span class="cx">     if (useDecoder && !m_decoder)
</span><span class="cx">         m_decoder = createDecoder();
</span><span class="lines">@@ -1049,7 +1056,7 @@
</span><span class="cx">             m_progressEventThrottle.dispatchThrottledProgressEvent(lengthComputable, m_receivedLength, total);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (m_state != LOADING)
</del><ins>+        if (readyState() != LOADING)
</ins><span class="cx">             changeState(LOADING);
</span><span class="cx">         else
</span><span class="cx">             // Firefox calls readyStateChanged every time it receives data, 4449442
</span><span class="lines">@@ -1085,7 +1092,7 @@
</span><span class="cx">     m_exceptionCode = TimeoutError;
</span><span class="cx"> 
</span><span class="cx">     if (!m_async) {
</span><del>-        m_state = DONE;
</del><ins>+        m_readyState = static_cast<State>(DONE);
</ins><span class="cx">         m_exceptionCode = TimeoutError;
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit222SourceWebCorexmlXMLHttpRequesth"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequest.h (236057 => 236058)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequest.h       2018-09-17 12:03:03 UTC (rev 236057)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequest.h  2018-09-17 12:03:12 UTC (rev 236058)
</span><span class="lines">@@ -49,13 +49,14 @@
</span><span class="cx"> class XMLHttpRequestUpload;
</span><span class="cx"> struct OwnedString;
</span><span class="cx"> 
</span><del>-class XMLHttpRequest final : public RefCounted<XMLHttpRequest>, public XMLHttpRequestEventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
</del><ins>+class XMLHttpRequest final : public ActiveDOMObject, public RefCounted<XMLHttpRequest>, private ThreadableLoaderClient, public XMLHttpRequestEventTarget {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     static Ref<XMLHttpRequest> create(ScriptExecutionContext&);
</span><span class="cx">     WEBCORE_EXPORT ~XMLHttpRequest();
</span><span class="cx"> 
</span><del>-    enum State {
</del><ins>+    // Keep it in 3bits.
+    enum State : uint8_t {
</ins><span class="cx">         UNSENT = 0,
</span><span class="cx">         OPENED = 1,
</span><span class="cx">         HEADERS_RECEIVED = 2,
</span><span class="lines">@@ -83,7 +84,7 @@
</span><span class="cx">     void abort();
</span><span class="cx">     ExceptionOr<void> setRequestHeader(const String& name, const String& value);
</span><span class="cx">     ExceptionOr<void> overrideMimeType(const String& override);
</span><del>-    bool doneWithoutErrors() const { return !m_error && m_state == DONE; }
</del><ins>+    bool doneWithoutErrors() const { return !m_error && readyState() == DONE; }
</ins><span class="cx">     String getAllResponseHeaders() const;
</span><span class="cx">     String getResponseHeader(const String& name) const;
</span><span class="cx">     ExceptionOr<OwnedString> responseText();
</span><span class="lines">@@ -102,7 +103,15 @@
</span><span class="cx">     bool responseCacheIsValid() const { return m_responseCacheIsValid; }
</span><span class="cx">     void didCacheResponse();
</span><span class="cx"> 
</span><del>-    enum class ResponseType { EmptyString, Arraybuffer, Blob, Document, Json, Text };
</del><ins>+    // Keep it in 3bits.
+    enum class ResponseType : uint8_t {
+        EmptyString = 0,
+        Arraybuffer = 1,
+        Blob = 2,
+        Document = 3,
+        Json = 4,
+        Text = 5,
+    };
</ins><span class="cx">     ExceptionOr<void> setResponseType(ResponseType);
</span><span class="cx">     ResponseType responseType() const;
</span><span class="cx"> 
</span><span class="lines">@@ -178,6 +187,23 @@
</span><span class="cx">     void resumeTimerFired();
</span><span class="cx">     Ref<TextResourceDecoder> createDecoder() const;
</span><span class="cx"> 
</span><ins>+    void networkErrorTimerFired();
+
+    unsigned m_async : 1;
+    unsigned m_includeCredentials : 1;
+    unsigned m_sendFlag : 1;
+    unsigned m_createdDocument : 1;
+    unsigned m_error : 1;
+    unsigned m_uploadListenerFlag : 1;
+    unsigned m_uploadComplete : 1;
+    unsigned m_wasAbortedByClient : 1;
+    unsigned m_responseCacheIsValid : 1;
+    unsigned m_dispatchErrorOnResuming : 1;
+    unsigned m_readyState : 3;
+    unsigned m_responseType : 3;
+
+    unsigned m_timeoutMilliseconds { 0 };
+
</ins><span class="cx">     std::unique_ptr<XMLHttpRequestUpload> m_upload;
</span><span class="cx"> 
</span><span class="cx">     URL m_url;
</span><span class="lines">@@ -185,56 +211,45 @@
</span><span class="cx">     HTTPHeaderMap m_requestHeaders;
</span><span class="cx">     RefPtr<FormData> m_requestEntityBody;
</span><span class="cx">     String m_mimeTypeOverride;
</span><del>-    bool m_async { true };
-    bool m_includeCredentials { false };
</del><span class="cx"> 
</span><span class="cx">     RefPtr<ThreadableLoader> m_loader;
</span><del>-    State m_state { UNSENT };
-    bool m_sendFlag { false };
</del><span class="cx"> 
</span><del>-    ResourceResponse m_response;
</del><span class="cx">     String m_responseEncoding;
</span><span class="cx"> 
</span><ins>+    ResourceResponse m_response;
+
</ins><span class="cx">     RefPtr<TextResourceDecoder> m_decoder;
</span><span class="cx"> 
</span><del>-    StringBuilder m_responseBuilder;
-    bool m_createdDocument { false };
</del><span class="cx">     RefPtr<Document> m_responseDocument;
</span><span class="cx"> 
</span><span class="cx">     RefPtr<SharedBuffer> m_binaryResponseBuilder;
</span><span class="cx"> 
</span><del>-    bool m_error { false };
</del><ins>+    StringBuilder m_responseBuilder;
</ins><span class="cx"> 
</span><del>-    bool m_uploadListenerFlag { false };
-    bool m_uploadComplete { false };
-
-    bool m_wasAbortedByClient { false };
-
</del><span class="cx">     // Used for progress event tracking.
</span><span class="cx">     long long m_receivedLength { 0 };
</span><span class="cx"> 
</span><del>-    std::optional<ExceptionCode> m_exceptionCode;
-
</del><span class="cx">     XMLHttpRequestProgressEventThrottle m_progressEventThrottle;
</span><span class="cx"> 
</span><del>-    ResponseType m_responseType { ResponseType::EmptyString };
-    bool m_responseCacheIsValid { false };
</del><span class="cx">     mutable String m_allResponseHeaders;
</span><span class="cx"> 
</span><span class="cx">     Timer m_resumeTimer;
</span><del>-    bool m_dispatchErrorOnResuming { false };
-
</del><span class="cx">     Timer m_networkErrorTimer;
</span><del>-    void networkErrorTimerFired();
</del><ins>+    Timer m_timeoutTimer;
</ins><span class="cx"> 
</span><del>-    unsigned m_timeoutMilliseconds { 0 };
</del><span class="cx">     MonotonicTime m_sendingTime;
</span><del>-    Timer m_timeoutTimer;
</del><ins>+
+    std::optional<ExceptionCode> m_exceptionCode;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline auto XMLHttpRequest::responseType() const -> ResponseType
</span><span class="cx"> {
</span><del>-    return m_responseType;
</del><ins>+    return static_cast<ResponseType>(m_responseType);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline auto XMLHttpRequest::readyState() const -> State
+{
+    return static_cast<State>(m_readyState);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit222SourceWebCorexmlXMLHttpRequestProgressEventThrottlecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp (236057 => 236058)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp        2018-09-17 12:03:03 UTC (rev 236057)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp   2018-09-17 12:03:12 UTC (rev 236058)
</span><span class="lines">@@ -37,11 +37,6 @@
</span><span class="cx"> 
</span><span class="cx"> XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle(EventTarget* target)
</span><span class="cx">     : m_target(target)
</span><del>-    , m_hasThrottledProgressEvent(false)
-    , m_lengthComputable(false)
-    , m_loaded(0)
-    , m_total(0)
-    , m_deferEvents(false)
</del><span class="cx">     , m_dispatchDeferredEventsTimer(*this, &XMLHttpRequestProgressEventThrottle::dispatchDeferredEvents)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(target);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit222SourceWebCorexmlXMLHttpRequestProgressEventThrottleh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h (236057 => 236058)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h  2018-09-17 12:03:03 UTC (rev 236057)
+++ releases/WebKitGTK/webkit-2.22/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h     2018-09-17 12:03:12 UTC (rev 236058)
</span><span class="lines">@@ -67,15 +67,16 @@
</span><span class="cx">     // Weak pointer to our XMLHttpRequest object as it is the one holding us.
</span><span class="cx">     EventTarget* m_target;
</span><span class="cx"> 
</span><del>-    bool m_hasThrottledProgressEvent;
-    bool m_lengthComputable;
-    unsigned long long m_loaded;
-    unsigned long long m_total;
</del><ins>+    unsigned long long m_loaded { 0 };
+    unsigned long long m_total { 0 };
</ins><span class="cx"> 
</span><del>-    bool m_deferEvents;
</del><span class="cx">     RefPtr<Event> m_deferredProgressEvent;
</span><span class="cx">     Vector<Ref<Event>> m_deferredEvents;
</span><span class="cx">     Timer m_dispatchDeferredEventsTimer;
</span><ins>+
+    bool m_hasThrottledProgressEvent { false };
+    bool m_lengthComputable { false };
+    bool m_deferEvents { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>