mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:37:35 +00:00
LibJS+Everywhere: Rename Value::to_string to to_deprecated_string
This commit is contained in:
parent
8f5bdce8e7
commit
afeb7273cc
68 changed files with 193 additions and 193 deletions
|
@ -52,7 +52,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> AudioConstructor::construct(
|
|||
// 4. If src is given, then set an attribute value for audio using "src" and src.
|
||||
// (This will cause the user agent to invoke the object's resource selection algorithm before returning.)
|
||||
if (!src_value.is_undefined()) {
|
||||
auto src = TRY(src_value.to_string(vm));
|
||||
auto src = TRY(src_value.to_deprecated_string(vm));
|
||||
MUST(audio->set_attribute(HTML::AttributeNames::src, move(src)));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::escape)
|
|||
if (!vm.argument_count())
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "CSS.escape");
|
||||
|
||||
auto identifier = TRY(vm.argument(0).to_string(vm));
|
||||
auto identifier = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
return JS::PrimitiveString::create(vm, Web::CSS::serialize_an_identifier(identifier));
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,13 @@ JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::supports)
|
|||
|
||||
if (vm.argument_count() >= 2) {
|
||||
// When the supports(property, value) method is invoked with two arguments property and value:
|
||||
auto property_name = TRY(vm.argument(0).to_string(vm));
|
||||
auto property_name = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
|
||||
// If property is an ASCII case-insensitive match for any defined CSS property that the UA supports,
|
||||
// and value successfully parses according to that property’s grammar, return true.
|
||||
auto property = CSS::property_id_from_string(property_name);
|
||||
if (property != CSS::PropertyID::Invalid) {
|
||||
auto value_string = TRY(vm.argument(1).to_string(vm));
|
||||
auto value_string = TRY(vm.argument(1).to_deprecated_string(vm));
|
||||
if (parse_css_value({}, value_string, property))
|
||||
return JS::Value(true);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::supports)
|
|||
return JS::Value(false);
|
||||
} else {
|
||||
// When the supports(conditionText) method is invoked with a single conditionText argument:
|
||||
auto supports_text = TRY(vm.argument(0).to_string(vm));
|
||||
auto supports_text = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
|
||||
// If conditionText, parsed and evaluated as a <supports-condition>, would return true, return true.
|
||||
if (auto supports = parse_css_supports({}, supports_text); supports && supports->matches())
|
||||
|
|
|
@ -61,7 +61,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
return JS::make_handle(static_cast<Request&>(arg0_object));
|
||||
}
|
||||
}
|
||||
return TRY(arg0.to_string(vm));
|
||||
return TRY(arg0.to_deprecated_string(vm));
|
||||
};
|
||||
Variant<JS::Handle<Request>, DeprecatedString> input = TRY(arg0_to_variant(arg0));
|
||||
auto arg1 = vm.argument(1);
|
||||
|
@ -89,7 +89,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (is<JS::ArrayBuffer>(body_property_value_object))
|
||||
return JS::make_handle(body_property_value_object);
|
||||
}
|
||||
return TRY(body_property_value.to_string(vm));
|
||||
return TRY(body_property_value.to_deprecated_string(vm));
|
||||
};
|
||||
Optional<Variant<JS::Handle<ReadableStream>, JS::Handle<Blob>, JS::Handle<JS::Object>, JS::Handle<URLSearchParams>, DeprecatedString>> body_value;
|
||||
if (!body_property_value.is_nullish())
|
||||
|
@ -102,7 +102,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (!cache_property_value.is_undefined()) {
|
||||
RequestCache cache_value { RequestCache::Default };
|
||||
if (!cache_property_value.is_undefined()) {
|
||||
auto cache_property_value_string = TRY(cache_property_value.to_string(vm));
|
||||
auto cache_property_value_string = TRY(cache_property_value.to_deprecated_string(vm));
|
||||
if (cache_property_value_string == "only-if-cached"sv)
|
||||
cache_value = RequestCache::OnlyIfCached;
|
||||
else if (cache_property_value_string == "default"sv)
|
||||
|
@ -126,7 +126,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (!credentials_property_value.is_undefined()) {
|
||||
RequestCredentials credentials_value { RequestCredentials::Omit };
|
||||
if (!credentials_property_value.is_undefined()) {
|
||||
auto credentials_property_value_string = TRY(credentials_property_value.to_string(vm));
|
||||
auto credentials_property_value_string = TRY(credentials_property_value.to_deprecated_string(vm));
|
||||
if (credentials_property_value_string == "same-origin"sv)
|
||||
credentials_value = RequestCredentials::SameOrigin;
|
||||
else if (credentials_property_value_string == "include"sv)
|
||||
|
@ -144,7 +144,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (!duplex_property_value.is_undefined()) {
|
||||
RequestDuplex duplex_value { RequestDuplex::Half };
|
||||
if (!duplex_property_value.is_undefined()) {
|
||||
auto duplex_property_value_string = TRY(duplex_property_value.to_string(vm));
|
||||
auto duplex_property_value_string = TRY(duplex_property_value.to_deprecated_string(vm));
|
||||
if (duplex_property_value_string == "half"sv)
|
||||
duplex_value = RequestDuplex::Half;
|
||||
else
|
||||
|
@ -187,7 +187,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (next_item2.is_null() && false) {
|
||||
sequence_item2 = DeprecatedString::empty();
|
||||
} else {
|
||||
sequence_item2 = TRY(next_item2.to_string(vm));
|
||||
sequence_item2 = TRY(next_item2.to_deprecated_string(vm));
|
||||
}
|
||||
sequence_item1.append(sequence_item2);
|
||||
}
|
||||
|
@ -206,14 +206,14 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (key1.is_null() && false) {
|
||||
typed_key1 = DeprecatedString::empty();
|
||||
} else {
|
||||
typed_key1 = TRY(key1.to_string(vm));
|
||||
typed_key1 = TRY(key1.to_deprecated_string(vm));
|
||||
}
|
||||
auto value1 = TRY(headers_property_value_object.get(property_key1));
|
||||
DeprecatedString typed_value1;
|
||||
if (value1.is_null() && false) {
|
||||
typed_value1 = DeprecatedString::empty();
|
||||
} else {
|
||||
typed_value1 = TRY(value1.to_string(vm));
|
||||
typed_value1 = TRY(value1.to_deprecated_string(vm));
|
||||
}
|
||||
record_union_type.set(typed_key1, typed_value1);
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (integrity_property_value.is_null() && false)
|
||||
integrity_value = DeprecatedString::empty();
|
||||
else
|
||||
integrity_value = TRY(integrity_property_value.to_string(vm));
|
||||
integrity_value = TRY(integrity_property_value.to_deprecated_string(vm));
|
||||
}
|
||||
init.integrity = integrity_value;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (method_property_value.is_null() && false)
|
||||
method_value = DeprecatedString::empty();
|
||||
else
|
||||
method_value = TRY(method_property_value.to_string(vm));
|
||||
method_value = TRY(method_property_value.to_deprecated_string(vm));
|
||||
}
|
||||
init.method = method_value;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (!mode_property_value.is_undefined()) {
|
||||
RequestMode mode_value { RequestMode::Navigate };
|
||||
if (!mode_property_value.is_undefined()) {
|
||||
auto mode_property_value_string = TRY(mode_property_value.to_string(vm));
|
||||
auto mode_property_value_string = TRY(mode_property_value.to_deprecated_string(vm));
|
||||
if (mode_property_value_string == "navigate"sv)
|
||||
mode_value = RequestMode::Navigate;
|
||||
else if (mode_property_value_string == "same-origin"sv)
|
||||
|
@ -287,7 +287,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (!redirect_property_value.is_undefined()) {
|
||||
RequestRedirect redirect_value { RequestRedirect::Follow };
|
||||
if (!redirect_property_value.is_undefined()) {
|
||||
auto redirect_property_value_string = TRY(redirect_property_value.to_string(vm));
|
||||
auto redirect_property_value_string = TRY(redirect_property_value.to_deprecated_string(vm));
|
||||
if (redirect_property_value_string == "follow"sv)
|
||||
redirect_value = RequestRedirect::Follow;
|
||||
else if (redirect_property_value_string == "manual"sv)
|
||||
|
@ -308,7 +308,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (referrer_property_value.is_null() && false)
|
||||
referrer_value = DeprecatedString::empty();
|
||||
else
|
||||
referrer_value = TRY(referrer_property_value.to_string(vm));
|
||||
referrer_value = TRY(referrer_property_value.to_deprecated_string(vm));
|
||||
}
|
||||
init.referrer = referrer_value;
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ JS::ThrowCompletionOr<JS::Value> fetch(JS::VM& vm)
|
|||
if (!referrer_policy_property_value.is_undefined()) {
|
||||
ReferrerPolicy referrer_policy_value { ReferrerPolicy::Empty };
|
||||
if (!referrer_policy_property_value.is_undefined()) {
|
||||
auto referrer_policy_property_value_string = TRY(referrer_policy_property_value.to_string(vm));
|
||||
auto referrer_policy_property_value_string = TRY(referrer_policy_property_value.to_deprecated_string(vm));
|
||||
if (referrer_policy_property_value_string == ""sv)
|
||||
referrer_policy_value = ReferrerPolicy::Empty;
|
||||
else if (referrer_policy_property_value_string == "same-origin"sv)
|
||||
|
|
|
@ -109,7 +109,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_setter)
|
|||
// FIXME: 1. If this's relevant Document is null, then return.
|
||||
|
||||
// 2. Parse the given value relative to the entry settings object. If that failed, throw a TypeError exception.
|
||||
auto new_href = TRY(vm.argument(0).to_string(vm));
|
||||
auto new_href = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
auto href_url = window.associated_document().parse_url(new_href);
|
||||
if (!href_url.is_valid())
|
||||
return vm.throw_completion<JS::URIError>(DeprecatedString::formatted("Invalid URL '{}'", new_href));
|
||||
|
@ -247,7 +247,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::reload)
|
|||
JS_DEFINE_NATIVE_FUNCTION(LocationObject::replace)
|
||||
{
|
||||
auto& window = verify_cast<HTML::Window>(HTML::current_global_object());
|
||||
auto url = TRY(vm.argument(0).to_string(vm));
|
||||
auto url = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
// FIXME: This needs spec compliance work.
|
||||
window.did_call_location_replace({}, move(url));
|
||||
return JS::js_undefined();
|
||||
|
|
|
@ -49,7 +49,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> OptionConstructor::construct
|
|||
|
||||
// 3. If text is not the empty string, then append to option a new Text node whose data is text.
|
||||
if (vm.argument_count() > 0) {
|
||||
auto text = TRY(vm.argument(0).to_string(vm));
|
||||
auto text = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
if (!text.is_empty()) {
|
||||
auto new_text_node = vm.heap().allocate<DOM::Text>(realm, document, text);
|
||||
MUST(option_element->append_child(*new_text_node));
|
||||
|
@ -58,7 +58,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> OptionConstructor::construct
|
|||
|
||||
// 4. If value is given, then set an attribute value for option using "value" and value.
|
||||
if (vm.argument_count() > 1) {
|
||||
auto value = TRY(vm.argument(1).to_string(vm));
|
||||
auto value = TRY(vm.argument(1).to_deprecated_string(vm));
|
||||
MUST(option_element->set_attribute(HTML::AttributeNames::value, value));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue