@@ -92,7 +92,7 @@ void XMLHttpRequest::visit_edges(Cell::Visitor& visitor)
92
92
}
93
93
94
94
// https://xhr.spec.whatwg.org/#concept-event-fire-progress
95
- static void fire_progress_event (XMLHttpRequestEventTarget& target, DeprecatedString const & event_name, u64 transmitted, u64 length)
95
+ static void fire_progress_event (XMLHttpRequestEventTarget& target, FlyString const & event_name, u64 transmitted, u64 length)
96
96
{
97
97
// To fire a progress event named e at target, given transmitted and length, means to fire an event named e at target, using ProgressEvent,
98
98
// with the loaded attribute initialized to transmitted, and if length is not 0, with the lengthComputable attribute initialized to true
@@ -102,7 +102,7 @@ static void fire_progress_event(XMLHttpRequestEventTarget& target, DeprecatedStr
102
102
event_init.loaded = transmitted;
103
103
event_init.total = length;
104
104
// FIXME: If we're in an async context, this will propagate to a callback context which can't propagate it anywhere else and does not expect this to fail.
105
- target.dispatch_event (*ProgressEvent::create (target.realm (), String::from_deprecated_string ( event_name). release_value_but_fixme_should_propagate_errors () , event_init).release_value_but_fixme_should_propagate_errors ());
105
+ target.dispatch_event (*ProgressEvent::create (target.realm (), event_name, event_init).release_value_but_fixme_should_propagate_errors ());
106
106
}
107
107
108
108
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsetext
@@ -277,21 +277,21 @@ ErrorOr<MimeSniff::MimeType> XMLHttpRequest::get_response_mime_type() const
277
277
ErrorOr<Optional<StringView>> XMLHttpRequest::get_final_encoding () const
278
278
{
279
279
// 1. Let label be null.
280
- Optional<DeprecatedString > label;
280
+ Optional<String > label;
281
281
282
282
// 2. Let responseMIME be the result of get a response MIME type for xhr.
283
283
auto response_mime = TRY (get_response_mime_type ());
284
284
285
285
// 3. If responseMIME’s parameters["charset"] exists, then set label to it.
286
286
auto response_mime_charset_it = response_mime.parameters ().find (" charset" sv);
287
287
if (response_mime_charset_it != response_mime.parameters ().end ())
288
- label = response_mime_charset_it->value . to_deprecated_string () ;
288
+ label = response_mime_charset_it->value ;
289
289
290
290
// 4. If xhr’s override MIME type’s parameters["charset"] exists, then set label to it.
291
291
if (m_override_mime_type.has_value ()) {
292
292
auto override_mime_charset_it = m_override_mime_type->parameters ().find (" charset" sv);
293
293
if (override_mime_charset_it != m_override_mime_type->parameters ().end ())
294
- label = override_mime_charset_it->value . to_deprecated_string () ;
294
+ label = override_mime_charset_it->value ;
295
295
}
296
296
297
297
// 5. If label is null, then return null.
@@ -607,7 +607,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<DocumentOrXMLHttpRequest
607
607
// 11. If this’s synchronous flag is unset, then:
608
608
if (!m_synchronous) {
609
609
// 1. Fire a progress event named loadstart at this with 0 and 0.
610
- fire_progress_event (*this , EventNames::loadstart. to_deprecated_fly_string () , 0 , 0 );
610
+ fire_progress_event (*this , EventNames::loadstart, 0 , 0 );
611
611
612
612
// 2. Let requestBodyTransmitted be 0.
613
613
// NOTE: This is kept on the XHR object itself instead of the stack, as we cannot capture references to stack variables in an async context.
@@ -625,7 +625,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<DocumentOrXMLHttpRequest
625
625
626
626
// 5. If this’s upload complete flag is unset and this’s upload listener flag is set, then fire a progress event named loadstart at this’s upload object with requestBodyTransmitted and requestBodyLength.
627
627
if (!m_upload_complete && m_upload_listener)
628
- fire_progress_event (m_upload_object, EventNames::loadstart. to_deprecated_fly_string () , m_request_body_transmitted, request_body_length);
628
+ fire_progress_event (m_upload_object, EventNames::loadstart, m_request_body_transmitted, request_body_length);
629
629
630
630
// 6. If this’s state is not opened or this’s send() flag is unset, then return.
631
631
if (m_state != State::Opened || !m_send)
@@ -642,7 +642,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<DocumentOrXMLHttpRequest
642
642
643
643
// 3. If this’s upload listener flag is set, then fire a progress event named progress at this’s upload object with requestBodyTransmitted and requestBodyLength.
644
644
if (m_upload_listener)
645
- fire_progress_event (m_upload_object, EventNames::progress. to_deprecated_fly_string () , m_request_body_transmitted, request_body_length);
645
+ fire_progress_event (m_upload_object, EventNames::progress, m_request_body_transmitted, request_body_length);
646
646
};
647
647
648
648
// 8. Let processRequestEndOfBody be these steps:
@@ -657,13 +657,13 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<DocumentOrXMLHttpRequest
657
657
return ;
658
658
659
659
// 3. Fire a progress event named progress at this’s upload object with requestBodyTransmitted and requestBodyLength.
660
- fire_progress_event (m_upload_object, EventNames::progress. to_deprecated_fly_string () , m_request_body_transmitted, request_body_length);
660
+ fire_progress_event (m_upload_object, EventNames::progress, m_request_body_transmitted, request_body_length);
661
661
662
662
// 4. Fire a progress event named load at this’s upload object with requestBodyTransmitted and requestBodyLength.
663
- fire_progress_event (m_upload_object, EventNames::load. to_deprecated_fly_string () , m_request_body_transmitted, request_body_length);
663
+ fire_progress_event (m_upload_object, EventNames::load, m_request_body_transmitted, request_body_length);
664
664
665
665
// 5. Fire a progress event named loadend at this’s upload object with requestBodyTransmitted and requestBodyLength.
666
- fire_progress_event (m_upload_object, EventNames::loadend. to_deprecated_fly_string () , m_request_body_transmitted, request_body_length);
666
+ fire_progress_event (m_upload_object, EventNames::loadend, m_request_body_transmitted, request_body_length);
667
667
};
668
668
669
669
// 9. Let processResponse, given a response, be these steps:
@@ -1017,7 +1017,7 @@ void XMLHttpRequest::abort()
1017
1017
// NOTE: This cannot throw as we don't pass in an exception. XHR::abort cannot be reached in a synchronous context where the state matches above.
1018
1018
// This is because it pauses inside XHR::send until the request is done or times out and then immediately calls `handle_response_end_of_body`
1019
1019
// which will always set `m_state` to `Done`.
1020
- MUST (request_error_steps (EventNames::abort. to_deprecated_fly_string () ));
1020
+ MUST (request_error_steps (EventNames::abort));
1021
1021
}
1022
1022
1023
1023
// 3. If this’s state is done, then set this’s state to unsent and this’s response to a network error.
@@ -1078,7 +1078,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::handle_response_end_of_body()
1078
1078
1079
1079
// 6. If xhr’s synchronous flag is unset, then fire a progress event named progress at xhr with transmitted and length.
1080
1080
if (!m_synchronous)
1081
- fire_progress_event (*this , EventNames::progress. to_deprecated_fly_string () , transmitted, length);
1081
+ fire_progress_event (*this , EventNames::progress, transmitted, length);
1082
1082
1083
1083
// 7. Set xhr’s state to done.
1084
1084
m_state = State::Done;
@@ -1091,10 +1091,10 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::handle_response_end_of_body()
1091
1091
dispatch_event (*DOM::Event::create (realm, EventNames::readystatechange).release_value_but_fixme_should_propagate_errors ());
1092
1092
1093
1093
// 10. Fire a progress event named load at xhr with transmitted and length.
1094
- fire_progress_event (*this , EventNames::load. to_deprecated_fly_string () , transmitted, length);
1094
+ fire_progress_event (*this , EventNames::load, transmitted, length);
1095
1095
1096
1096
// 11. Fire a progress event named loadend at xhr with transmitted and length.
1097
- fire_progress_event (*this , EventNames::loadend. to_deprecated_fly_string () , transmitted, length);
1097
+ fire_progress_event (*this , EventNames::loadend, transmitted, length);
1098
1098
1099
1099
return {};
1100
1100
}
@@ -1108,20 +1108,20 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::handle_errors()
1108
1108
1109
1109
// 2. If xhr’s timed out flag is set, then run the request error steps for xhr, timeout, and "TimeoutError" DOMException.
1110
1110
if (m_timed_out)
1111
- return TRY (request_error_steps (EventNames::timeout. to_deprecated_fly_string () , WebIDL::TimeoutError::create (realm (), " Timed out" sv)));
1111
+ return TRY (request_error_steps (EventNames::timeout, WebIDL::TimeoutError::create (realm (), " Timed out" sv)));
1112
1112
1113
1113
// 3. Otherwise, if xhr’s response’s aborted flag is set, run the request error steps for xhr, abort, and "AbortError" DOMException.
1114
1114
if (m_response->aborted ())
1115
- return TRY (request_error_steps (EventNames::abort. to_deprecated_fly_string () , WebIDL::AbortError::create (realm (), " Aborted" sv)));
1115
+ return TRY (request_error_steps (EventNames::abort, WebIDL::AbortError::create (realm (), " Aborted" sv)));
1116
1116
1117
1117
// 4. Otherwise, if xhr’s response is a network error, then run the request error steps for xhr, error, and "NetworkError" DOMException.
1118
1118
if (m_response->is_network_error ())
1119
- return TRY (request_error_steps (EventNames::error. to_deprecated_fly_string () , WebIDL::NetworkError::create (realm (), " Network error" sv)));
1119
+ return TRY (request_error_steps (EventNames::error, WebIDL::NetworkError::create (realm (), " Network error" sv)));
1120
1120
1121
1121
return {};
1122
1122
}
1123
1123
1124
- JS::ThrowCompletionOr<void > XMLHttpRequest::request_error_steps (DeprecatedFlyString const & event_name, JS::GCPtr<WebIDL::DOMException> exception)
1124
+ JS::ThrowCompletionOr<void > XMLHttpRequest::request_error_steps (FlyString const & event_name, JS::GCPtr<WebIDL::DOMException> exception)
1125
1125
{
1126
1126
// 1. Set xhr’s state to done.
1127
1127
m_state = State::Done;
@@ -1153,15 +1153,15 @@ JS::ThrowCompletionOr<void> XMLHttpRequest::request_error_steps(DeprecatedFlyStr
1153
1153
fire_progress_event (m_upload_object, event_name, 0 , 0 );
1154
1154
1155
1155
// 2. Fire a progress event named loadend at xhr’s upload object with 0 and 0.
1156
- fire_progress_event (m_upload_object, EventNames::loadend. to_deprecated_fly_string () , 0 , 0 );
1156
+ fire_progress_event (m_upload_object, EventNames::loadend, 0 , 0 );
1157
1157
}
1158
1158
}
1159
1159
1160
1160
// 7. Fire a progress event named event at xhr with 0 and 0.
1161
1161
fire_progress_event (*this , event_name, 0 , 0 );
1162
1162
1163
1163
// 8. Fire a progress event named loadend at xhr with 0 and 0.
1164
- fire_progress_event (*this , EventNames::loadend. to_deprecated_fly_string () , 0 , 0 );
1164
+ fire_progress_event (*this , EventNames::loadend, 0 , 0 );
1165
1165
1166
1166
return {};
1167
1167
}
0 commit comments