mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:47:34 +00:00
AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()
This is a preparatory step to making `get()` return `ErrorOr`.
This commit is contained in:
parent
efe4329f9f
commit
1dd6b7f5b7
76 changed files with 671 additions and 671 deletions
|
@ -227,7 +227,7 @@ public:
|
|||
|
||||
void handle_request(JsonObject const& request)
|
||||
{
|
||||
auto type = request.get("type"sv).as_string_or({});
|
||||
auto type = request.get_deprecated("type"sv).as_string_or({});
|
||||
|
||||
if (type.is_null()) {
|
||||
dbgln("RPC client sent request without type field");
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
}
|
||||
|
||||
if (type == "SetInspectedObject") {
|
||||
auto address = request.get("address"sv).to_number<FlatPtr>();
|
||||
auto address = request.get_deprecated("address"sv).to_number<FlatPtr>();
|
||||
for (auto& object : Object::all_objects()) {
|
||||
if ((FlatPtr)&object == address) {
|
||||
if (auto inspected_object = m_inspected_object.strong_ref())
|
||||
|
@ -279,10 +279,10 @@ public:
|
|||
}
|
||||
|
||||
if (type == "SetProperty") {
|
||||
auto address = request.get("address"sv).to_number<FlatPtr>();
|
||||
auto address = request.get_deprecated("address"sv).to_number<FlatPtr>();
|
||||
for (auto& object : Object::all_objects()) {
|
||||
if ((FlatPtr)&object == address) {
|
||||
bool success = object.set_property(request.get("name"sv).to_deprecated_string(), request.get("value"sv));
|
||||
bool success = object.set_property(request.get_deprecated("name"sv).to_deprecated_string(), request.get_deprecated("value"sv));
|
||||
JsonObject response;
|
||||
response.set("type", "SetProperty");
|
||||
response.set("success", success);
|
||||
|
|
|
@ -332,36 +332,36 @@ requires IsBaseOf<Object, T>
|
|||
}, \
|
||||
{});
|
||||
|
||||
#define REGISTER_RECT_PROPERTY(property_name, getter, setter) \
|
||||
register_property( \
|
||||
property_name, \
|
||||
[this] { \
|
||||
auto rect = this->getter(); \
|
||||
JsonObject rect_object; \
|
||||
rect_object.set("x"sv, rect.x()); \
|
||||
rect_object.set("y"sv, rect.y()); \
|
||||
rect_object.set("width"sv, rect.width()); \
|
||||
rect_object.set("height"sv, rect.height()); \
|
||||
return rect_object; \
|
||||
}, \
|
||||
[this](auto& value) { \
|
||||
Gfx::IntRect rect; \
|
||||
if (value.is_object()) { \
|
||||
rect.set_x(value.as_object().get("x"sv).to_i32()); \
|
||||
rect.set_y(value.as_object().get("y"sv).to_i32()); \
|
||||
rect.set_width(value.as_object().get("width"sv).to_i32()); \
|
||||
rect.set_height(value.as_object().get("height"sv).to_i32()); \
|
||||
} else if (value.is_array() && value.as_array().size() == 4) { \
|
||||
rect.set_x(value.as_array()[0].to_i32()); \
|
||||
rect.set_y(value.as_array()[1].to_i32()); \
|
||||
rect.set_width(value.as_array()[2].to_i32()); \
|
||||
rect.set_height(value.as_array()[3].to_i32()); \
|
||||
} else { \
|
||||
return false; \
|
||||
} \
|
||||
setter(rect); \
|
||||
\
|
||||
return true; \
|
||||
#define REGISTER_RECT_PROPERTY(property_name, getter, setter) \
|
||||
register_property( \
|
||||
property_name, \
|
||||
[this] { \
|
||||
auto rect = this->getter(); \
|
||||
JsonObject rect_object; \
|
||||
rect_object.set("x"sv, rect.x()); \
|
||||
rect_object.set("y"sv, rect.y()); \
|
||||
rect_object.set("width"sv, rect.width()); \
|
||||
rect_object.set("height"sv, rect.height()); \
|
||||
return rect_object; \
|
||||
}, \
|
||||
[this](auto& value) { \
|
||||
Gfx::IntRect rect; \
|
||||
if (value.is_object()) { \
|
||||
rect.set_x(value.as_object().get_deprecated("x"sv).to_i32()); \
|
||||
rect.set_y(value.as_object().get_deprecated("y"sv).to_i32()); \
|
||||
rect.set_width(value.as_object().get_deprecated("width"sv).to_i32()); \
|
||||
rect.set_height(value.as_object().get_deprecated("height"sv).to_i32()); \
|
||||
} else if (value.is_array() && value.as_array().size() == 4) { \
|
||||
rect.set_x(value.as_array()[0].to_i32()); \
|
||||
rect.set_y(value.as_array()[1].to_i32()); \
|
||||
rect.set_width(value.as_array()[2].to_i32()); \
|
||||
rect.set_height(value.as_array()[3].to_i32()); \
|
||||
} else { \
|
||||
return false; \
|
||||
} \
|
||||
setter(rect); \
|
||||
\
|
||||
return true; \
|
||||
});
|
||||
|
||||
#define REGISTER_SIZE_PROPERTY(property_name, getter, setter) \
|
||||
|
|
|
@ -23,56 +23,56 @@ ErrorOr<AllProcessesStatistics> ProcessStatisticsReader::get_all(Core::Stream::S
|
|||
|
||||
auto file_contents = TRY(proc_all_file.read_until_eof());
|
||||
auto json_obj = TRY(JsonValue::from_string(file_contents)).as_object();
|
||||
json_obj.get("processes"sv).as_array().for_each([&](auto& value) {
|
||||
json_obj.get_deprecated("processes"sv).as_array().for_each([&](auto& value) {
|
||||
const JsonObject& process_object = value.as_object();
|
||||
Core::ProcessStatistics process;
|
||||
|
||||
// kernel data first
|
||||
process.pid = process_object.get("pid"sv).to_u32();
|
||||
process.pgid = process_object.get("pgid"sv).to_u32();
|
||||
process.pgp = process_object.get("pgp"sv).to_u32();
|
||||
process.sid = process_object.get("sid"sv).to_u32();
|
||||
process.uid = process_object.get("uid"sv).to_u32();
|
||||
process.gid = process_object.get("gid"sv).to_u32();
|
||||
process.ppid = process_object.get("ppid"sv).to_u32();
|
||||
process.nfds = process_object.get("nfds"sv).to_u32();
|
||||
process.kernel = process_object.get("kernel"sv).to_bool();
|
||||
process.name = process_object.get("name"sv).to_deprecated_string();
|
||||
process.executable = process_object.get("executable"sv).to_deprecated_string();
|
||||
process.tty = process_object.get("tty"sv).to_deprecated_string();
|
||||
process.pledge = process_object.get("pledge"sv).to_deprecated_string();
|
||||
process.veil = process_object.get("veil"sv).to_deprecated_string();
|
||||
process.amount_virtual = process_object.get("amount_virtual"sv).to_u32();
|
||||
process.amount_resident = process_object.get("amount_resident"sv).to_u32();
|
||||
process.amount_shared = process_object.get("amount_shared"sv).to_u32();
|
||||
process.amount_dirty_private = process_object.get("amount_dirty_private"sv).to_u32();
|
||||
process.amount_clean_inode = process_object.get("amount_clean_inode"sv).to_u32();
|
||||
process.amount_purgeable_volatile = process_object.get("amount_purgeable_volatile"sv).to_u32();
|
||||
process.amount_purgeable_nonvolatile = process_object.get("amount_purgeable_nonvolatile"sv).to_u32();
|
||||
process.pid = process_object.get_deprecated("pid"sv).to_u32();
|
||||
process.pgid = process_object.get_deprecated("pgid"sv).to_u32();
|
||||
process.pgp = process_object.get_deprecated("pgp"sv).to_u32();
|
||||
process.sid = process_object.get_deprecated("sid"sv).to_u32();
|
||||
process.uid = process_object.get_deprecated("uid"sv).to_u32();
|
||||
process.gid = process_object.get_deprecated("gid"sv).to_u32();
|
||||
process.ppid = process_object.get_deprecated("ppid"sv).to_u32();
|
||||
process.nfds = process_object.get_deprecated("nfds"sv).to_u32();
|
||||
process.kernel = process_object.get_deprecated("kernel"sv).to_bool();
|
||||
process.name = process_object.get_deprecated("name"sv).to_deprecated_string();
|
||||
process.executable = process_object.get_deprecated("executable"sv).to_deprecated_string();
|
||||
process.tty = process_object.get_deprecated("tty"sv).to_deprecated_string();
|
||||
process.pledge = process_object.get_deprecated("pledge"sv).to_deprecated_string();
|
||||
process.veil = process_object.get_deprecated("veil"sv).to_deprecated_string();
|
||||
process.amount_virtual = process_object.get_deprecated("amount_virtual"sv).to_u32();
|
||||
process.amount_resident = process_object.get_deprecated("amount_resident"sv).to_u32();
|
||||
process.amount_shared = process_object.get_deprecated("amount_shared"sv).to_u32();
|
||||
process.amount_dirty_private = process_object.get_deprecated("amount_dirty_private"sv).to_u32();
|
||||
process.amount_clean_inode = process_object.get_deprecated("amount_clean_inode"sv).to_u32();
|
||||
process.amount_purgeable_volatile = process_object.get_deprecated("amount_purgeable_volatile"sv).to_u32();
|
||||
process.amount_purgeable_nonvolatile = process_object.get_deprecated("amount_purgeable_nonvolatile"sv).to_u32();
|
||||
|
||||
auto& thread_array = process_object.get_ptr("threads"sv)->as_array();
|
||||
process.threads.ensure_capacity(thread_array.size());
|
||||
thread_array.for_each([&](auto& value) {
|
||||
auto& thread_object = value.as_object();
|
||||
Core::ThreadStatistics thread;
|
||||
thread.tid = thread_object.get("tid"sv).to_u32();
|
||||
thread.times_scheduled = thread_object.get("times_scheduled"sv).to_u32();
|
||||
thread.name = thread_object.get("name"sv).to_deprecated_string();
|
||||
thread.state = thread_object.get("state"sv).to_deprecated_string();
|
||||
thread.time_user = thread_object.get("time_user"sv).to_u64();
|
||||
thread.time_kernel = thread_object.get("time_kernel"sv).to_u64();
|
||||
thread.cpu = thread_object.get("cpu"sv).to_u32();
|
||||
thread.priority = thread_object.get("priority"sv).to_u32();
|
||||
thread.syscall_count = thread_object.get("syscall_count"sv).to_u32();
|
||||
thread.inode_faults = thread_object.get("inode_faults"sv).to_u32();
|
||||
thread.zero_faults = thread_object.get("zero_faults"sv).to_u32();
|
||||
thread.cow_faults = thread_object.get("cow_faults"sv).to_u32();
|
||||
thread.unix_socket_read_bytes = thread_object.get("unix_socket_read_bytes"sv).to_u32();
|
||||
thread.unix_socket_write_bytes = thread_object.get("unix_socket_write_bytes"sv).to_u32();
|
||||
thread.ipv4_socket_read_bytes = thread_object.get("ipv4_socket_read_bytes"sv).to_u32();
|
||||
thread.ipv4_socket_write_bytes = thread_object.get("ipv4_socket_write_bytes"sv).to_u32();
|
||||
thread.file_read_bytes = thread_object.get("file_read_bytes"sv).to_u32();
|
||||
thread.file_write_bytes = thread_object.get("file_write_bytes"sv).to_u32();
|
||||
thread.tid = thread_object.get_deprecated("tid"sv).to_u32();
|
||||
thread.times_scheduled = thread_object.get_deprecated("times_scheduled"sv).to_u32();
|
||||
thread.name = thread_object.get_deprecated("name"sv).to_deprecated_string();
|
||||
thread.state = thread_object.get_deprecated("state"sv).to_deprecated_string();
|
||||
thread.time_user = thread_object.get_deprecated("time_user"sv).to_u64();
|
||||
thread.time_kernel = thread_object.get_deprecated("time_kernel"sv).to_u64();
|
||||
thread.cpu = thread_object.get_deprecated("cpu"sv).to_u32();
|
||||
thread.priority = thread_object.get_deprecated("priority"sv).to_u32();
|
||||
thread.syscall_count = thread_object.get_deprecated("syscall_count"sv).to_u32();
|
||||
thread.inode_faults = thread_object.get_deprecated("inode_faults"sv).to_u32();
|
||||
thread.zero_faults = thread_object.get_deprecated("zero_faults"sv).to_u32();
|
||||
thread.cow_faults = thread_object.get_deprecated("cow_faults"sv).to_u32();
|
||||
thread.unix_socket_read_bytes = thread_object.get_deprecated("unix_socket_read_bytes"sv).to_u32();
|
||||
thread.unix_socket_write_bytes = thread_object.get_deprecated("unix_socket_write_bytes"sv).to_u32();
|
||||
thread.ipv4_socket_read_bytes = thread_object.get_deprecated("ipv4_socket_read_bytes"sv).to_u32();
|
||||
thread.ipv4_socket_write_bytes = thread_object.get_deprecated("ipv4_socket_write_bytes"sv).to_u32();
|
||||
thread.file_read_bytes = thread_object.get_deprecated("file_read_bytes"sv).to_u32();
|
||||
thread.file_write_bytes = thread_object.get_deprecated("file_write_bytes"sv).to_u32();
|
||||
process.threads.append(move(thread));
|
||||
});
|
||||
|
||||
|
@ -83,8 +83,8 @@ ErrorOr<AllProcessesStatistics> ProcessStatisticsReader::get_all(Core::Stream::S
|
|||
all_processes_statistics.processes.append(move(process));
|
||||
});
|
||||
|
||||
all_processes_statistics.total_time_scheduled = json_obj.get("total_time"sv).to_u64();
|
||||
all_processes_statistics.total_time_scheduled_kernel = json_obj.get("total_time_kernel"sv).to_u64();
|
||||
all_processes_statistics.total_time_scheduled = json_obj.get_deprecated("total_time"sv).to_u64();
|
||||
all_processes_statistics.total_time_scheduled_kernel = json_obj.get_deprecated("total_time_kernel"sv).to_u64();
|
||||
return all_processes_statistics;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,14 +196,14 @@ Optional<MemoryRegionInfo> Reader::region_containing(FlatPtr address) const
|
|||
int Reader::process_pid() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto pid = process_info.get("pid"sv);
|
||||
auto pid = process_info.get_deprecated("pid"sv);
|
||||
return pid.to_number<int>();
|
||||
}
|
||||
|
||||
u8 Reader::process_termination_signal() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto termination_signal = process_info.get("termination_signal"sv);
|
||||
auto termination_signal = process_info.get_deprecated("termination_signal"sv);
|
||||
auto signal_number = termination_signal.to_number<u8>();
|
||||
if (signal_number <= SIGINVAL || signal_number >= NSIG)
|
||||
return SIGINVAL;
|
||||
|
@ -213,14 +213,14 @@ u8 Reader::process_termination_signal() const
|
|||
DeprecatedString Reader::process_executable_path() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto executable_path = process_info.get("executable_path"sv);
|
||||
auto executable_path = process_info.get_deprecated("executable_path"sv);
|
||||
return executable_path.as_string_or({});
|
||||
}
|
||||
|
||||
Vector<DeprecatedString> Reader::process_arguments() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto arguments = process_info.get("arguments"sv);
|
||||
auto arguments = process_info.get_deprecated("arguments"sv);
|
||||
if (!arguments.is_array())
|
||||
return {};
|
||||
Vector<DeprecatedString> vector;
|
||||
|
@ -234,7 +234,7 @@ Vector<DeprecatedString> Reader::process_arguments() const
|
|||
Vector<DeprecatedString> Reader::process_environment() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto environment = process_info.get("environment"sv);
|
||||
auto environment = process_info.get_deprecated("environment"sv);
|
||||
if (!environment.is_array())
|
||||
return {};
|
||||
Vector<DeprecatedString> vector;
|
||||
|
|
|
@ -449,7 +449,7 @@ void DebugSession::update_loaded_libs()
|
|||
|
||||
vm_entries.for_each([&](auto& entry) {
|
||||
// TODO: check that region is executable
|
||||
auto vm_name = entry.as_object().get("name"sv).as_string();
|
||||
auto vm_name = entry.as_object().get_deprecated("name"sv).as_string();
|
||||
|
||||
auto object_path = get_path_to_object(vm_name);
|
||||
if (!object_path.has_value())
|
||||
|
@ -459,7 +459,7 @@ void DebugSession::update_loaded_libs()
|
|||
if (Core::File::looks_like_shared_library(lib_name))
|
||||
lib_name = LexicalPath::basename(object_path.value());
|
||||
|
||||
FlatPtr base_address = entry.as_object().get("address"sv).to_addr();
|
||||
FlatPtr base_address = entry.as_object().get_deprecated("address"sv).to_addr();
|
||||
if (auto it = m_loaded_libraries.find(lib_name); it != m_loaded_libraries.end()) {
|
||||
// We expect the VM regions to be sorted by address.
|
||||
VERIFY(base_address >= it->value->base_address);
|
||||
|
|
|
@ -18,8 +18,8 @@ auto Launcher::Details::from_details_str(DeprecatedString const& details_str) ->
|
|||
auto details = adopt_ref(*new Details);
|
||||
auto json = JsonValue::from_string(details_str).release_value_but_fixme_should_propagate_errors();
|
||||
auto const& obj = json.as_object();
|
||||
details->executable = obj.get("executable"sv).to_deprecated_string();
|
||||
details->name = obj.get("name"sv).to_deprecated_string();
|
||||
details->executable = obj.get_deprecated("executable"sv).to_deprecated_string();
|
||||
details->name = obj.get_deprecated("name"sv).to_deprecated_string();
|
||||
if (auto type_value = obj.get_ptr("type"sv)) {
|
||||
auto type_str = type_value->to_deprecated_string();
|
||||
if (type_str == "app")
|
||||
|
|
|
@ -56,8 +56,8 @@ ErrorOr<void> CommonLocationsProvider::load_from_json(StringView json_path)
|
|||
if (!entry_value.is_object())
|
||||
continue;
|
||||
auto entry = entry_value.as_object();
|
||||
auto name = entry.get("name"sv).to_deprecated_string();
|
||||
auto path = entry.get("path"sv).to_deprecated_string();
|
||||
auto name = entry.get_deprecated("name"sv).to_deprecated_string();
|
||||
auto path = entry.get_deprecated("path"sv).to_deprecated_string();
|
||||
TRY(s_common_locations.try_append({ name, path }));
|
||||
}
|
||||
|
||||
|
|
|
@ -119,12 +119,12 @@ Variant JsonArrayModel::data(ModelIndex const& index, ModelRole role) const
|
|||
|
||||
if (role == ModelRole::Display) {
|
||||
auto& json_field_name = field_spec.json_field_name;
|
||||
auto data = object.get(json_field_name);
|
||||
auto data = object.get_deprecated(json_field_name);
|
||||
if (field_spec.massage_for_display)
|
||||
return field_spec.massage_for_display(object);
|
||||
if (data.is_number())
|
||||
return data;
|
||||
return object.get(json_field_name).to_deprecated_string();
|
||||
return object.get_deprecated(json_field_name).to_deprecated_string();
|
||||
}
|
||||
|
||||
if (role == ModelRole::Sort) {
|
||||
|
|
|
@ -306,9 +306,9 @@ inline auto clamp<GUI::UIDimension>(GUI::UIDimension const& input, GUI::UIDimens
|
|||
if (!value.is_object()) \
|
||||
return false; \
|
||||
auto result_width = GUI::UIDimension::construct_from_json_value( \
|
||||
value.as_object().get("width"sv)); \
|
||||
value.as_object().get_deprecated("width"sv)); \
|
||||
auto result_height = GUI::UIDimension::construct_from_json_value( \
|
||||
value.as_object().get("height"sv)); \
|
||||
value.as_object().get_deprecated("height"sv)); \
|
||||
if (result_width.has_value() && result_height.has_value()) { \
|
||||
GUI::UISize size(result_width.value(), result_height.value()); \
|
||||
setter(size); \
|
||||
|
|
|
@ -63,7 +63,7 @@ Vector<u32> CharacterMapFile::read_map(JsonObject const& json, DeprecatedString
|
|||
Vector<u32> buffer;
|
||||
buffer.resize(CHAR_MAP_SIZE);
|
||||
|
||||
auto map_arr = json.get(name).as_array();
|
||||
auto map_arr = json.get_deprecated(name).as_array();
|
||||
for (size_t i = 0; i < map_arr.size(); i++) {
|
||||
auto key_value = map_arr.at(i).as_string();
|
||||
if (key_value.length() == 0) {
|
||||
|
|
|
@ -181,9 +181,9 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid, IncludeSourcePosition in
|
|||
|
||||
for (auto& region_value : json.value().as_array().values()) {
|
||||
auto& region = region_value.as_object();
|
||||
auto name = region.get("name"sv).to_deprecated_string();
|
||||
auto address = region.get("address"sv).to_addr();
|
||||
auto size = region.get("size"sv).to_addr();
|
||||
auto name = region.get_deprecated("name"sv).to_deprecated_string();
|
||||
auto address = region.get_deprecated("address"sv).to_addr();
|
||||
auto size = region.get_deprecated("size"sv).to_addr();
|
||||
|
||||
DeprecatedString path;
|
||||
if (name == "/usr/lib/Loader.so") {
|
||||
|
|
|
@ -422,7 +422,7 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path)
|
|||
VERIFY(test_value.is_object());
|
||||
VERIFY(test_value.as_object().has("result"sv));
|
||||
|
||||
auto result = test_value.as_object().get("result"sv);
|
||||
auto result = test_value.as_object().get_deprecated("result"sv);
|
||||
VERIFY(result.is_string());
|
||||
auto result_string = result.as_string();
|
||||
if (result_string == "pass") {
|
||||
|
@ -433,7 +433,7 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path)
|
|||
m_counts.tests_failed++;
|
||||
suite.most_severe_test_result = Test::Result::Fail;
|
||||
VERIFY(test_value.as_object().has("details"sv));
|
||||
auto details = test_value.as_object().get("details"sv);
|
||||
auto details = test_value.as_object().get_deprecated("details"sv);
|
||||
VERIFY(result.is_string());
|
||||
test.details = details.as_string();
|
||||
} else {
|
||||
|
@ -443,7 +443,7 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path)
|
|||
m_counts.tests_skipped++;
|
||||
}
|
||||
|
||||
test.duration_us = test_value.as_object().get("duration"sv).to_u64(0);
|
||||
test.duration_us = test_value.as_object().get_deprecated("duration"sv).to_u64(0);
|
||||
|
||||
suite.tests.append(test);
|
||||
});
|
||||
|
|
|
@ -267,20 +267,20 @@ static JsonValue match_capabilities(JsonObject const& capabilities)
|
|||
// -> "browserName"
|
||||
if (name == "browserName"sv) {
|
||||
// If value is not a string equal to the "browserName" entry in matched capabilities, return success with data null.
|
||||
if (value.as_string() != matched_capabilities.get(name).as_string())
|
||||
if (value.as_string() != matched_capabilities.get_deprecated(name).as_string())
|
||||
return AK::Error::from_string_view("browserName"sv);
|
||||
}
|
||||
// -> "browserVersion"
|
||||
else if (name == "browserVersion"sv) {
|
||||
// Compare value to the "browserVersion" entry in matched capabilities using an implementation-defined comparison algorithm. The comparison is to accept a value that places constraints on the version using the "<", "<=", ">", and ">=" operators.
|
||||
// If the two values do not match, return success with data null.
|
||||
if (!matches_browser_version(value.as_string(), matched_capabilities.get(name).as_string()))
|
||||
if (!matches_browser_version(value.as_string(), matched_capabilities.get_deprecated(name).as_string()))
|
||||
return AK::Error::from_string_view("browserVersion"sv);
|
||||
}
|
||||
// -> "platformName"
|
||||
else if (name == "platformName"sv) {
|
||||
// If value is not a string equal to the "platformName" entry in matched capabilities, return success with data null.
|
||||
if (!matches_platform_name(value.as_string(), matched_capabilities.get(name).as_string()))
|
||||
if (!matches_platform_name(value.as_string(), matched_capabilities.get_deprecated(name).as_string()))
|
||||
return AK::Error::from_string_view("platformName"sv);
|
||||
}
|
||||
// -> "acceptInsecureCerts"
|
||||
|
|
|
@ -48,7 +48,7 @@ ErrorOr<TimeoutsConfiguration, Error> json_deserialize_as_a_timeouts_configurati
|
|||
// 3. If value has a property with the key "script":
|
||||
if (value.as_object().has("script"sv)) {
|
||||
// 1. Let script duration be the value of property "script".
|
||||
auto const& script_duration = value.as_object().get("script"sv);
|
||||
auto const& script_duration = value.as_object().get_deprecated("script"sv);
|
||||
|
||||
// 2. If script duration is a number and less than 0 or greater than maximum safe integer, or it is not null, return error with error code invalid argument.
|
||||
if (script_duration.is_number() && (script_duration.to_i64() < 0 || script_duration.to_i64() > max_safe_integer))
|
||||
|
@ -63,7 +63,7 @@ ErrorOr<TimeoutsConfiguration, Error> json_deserialize_as_a_timeouts_configurati
|
|||
// 4. If value has a property with the key "pageLoad":
|
||||
if (value.as_object().has("pageLoad"sv)) {
|
||||
// 1. Let page load duration be the value of property "pageLoad".
|
||||
auto const& page_load_duration = value.as_object().get("pageLoad"sv);
|
||||
auto const& page_load_duration = value.as_object().get_deprecated("pageLoad"sv);
|
||||
|
||||
// 2. If page load duration is less than 0 or greater than maximum safe integer, return error with error code invalid argument.
|
||||
if (!page_load_duration.is_number() || page_load_duration.to_i64() < 0 || page_load_duration.to_i64() > max_safe_integer)
|
||||
|
@ -76,7 +76,7 @@ ErrorOr<TimeoutsConfiguration, Error> json_deserialize_as_a_timeouts_configurati
|
|||
// 5. If value has a property with the key "implicit":
|
||||
if (value.as_object().has("implicit"sv)) {
|
||||
// 1. Let implicit duration be the value of property "implicit".
|
||||
auto const& implicit_duration = value.as_object().get("implicit"sv);
|
||||
auto const& implicit_duration = value.as_object().get_deprecated("implicit"sv);
|
||||
|
||||
// 2. If implicit duration is less than 0 or greater than maximum safe integer, return error with error code invalid argument.
|
||||
if (!implicit_duration.is_number() || implicit_duration.to_i64() < 0 || implicit_duration.to_i64() > max_safe_integer)
|
||||
|
|
|
@ -83,13 +83,13 @@ int AccessibilityTreeModel::column_count(const GUI::ModelIndex&) const
|
|||
GUI::Variant AccessibilityTreeModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const
|
||||
{
|
||||
auto const& node = *static_cast<JsonObject const*>(index.internal_data());
|
||||
auto type = node.get("type"sv).as_string_or("unknown"sv);
|
||||
auto type = node.get_deprecated("type"sv).as_string_or("unknown"sv);
|
||||
|
||||
if (role == GUI::ModelRole::Display) {
|
||||
if (type == "text")
|
||||
return node.get("text"sv).as_string();
|
||||
return node.get_deprecated("text"sv).as_string();
|
||||
|
||||
auto node_role = node.get("role"sv).as_string();
|
||||
auto node_role = node.get_deprecated("role"sv).as_string();
|
||||
if (type != "element")
|
||||
return node_role;
|
||||
|
||||
|
|
|
@ -119,8 +119,8 @@ static DeprecatedString with_whitespace_collapsed(StringView string)
|
|||
GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
{
|
||||
auto const& node = *static_cast<JsonObject const*>(index.internal_data());
|
||||
auto node_name = node.get("name"sv).as_string();
|
||||
auto type = node.get("type"sv).as_string_or("unknown"sv);
|
||||
auto node_name = node.get_deprecated("name"sv).as_string();
|
||||
auto type = node.get_deprecated("type"sv).as_string_or("unknown"sv);
|
||||
|
||||
// FIXME: This FIXME can go away when we fix the one below.
|
||||
#ifdef AK_OS_SERENITY
|
||||
|
@ -131,7 +131,7 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
|||
return m_tree_view->palette().syntax_comment();
|
||||
if (type == "pseudo-element"sv)
|
||||
return m_tree_view->palette().syntax_type();
|
||||
if (!node.get("visible"sv).to_bool(true))
|
||||
if (!node.get_deprecated("visible"sv).to_bool(true))
|
||||
return m_tree_view->palette().syntax_comment();
|
||||
return {};
|
||||
}
|
||||
|
@ -151,9 +151,9 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
|||
|
||||
if (role == GUI::ModelRole::Display) {
|
||||
if (type == "text")
|
||||
return with_whitespace_collapsed(node.get("text"sv).as_string());
|
||||
return with_whitespace_collapsed(node.get_deprecated("text"sv).as_string());
|
||||
if (type == "comment"sv)
|
||||
return DeprecatedString::formatted("<!--{}-->", node.get("data"sv).as_string());
|
||||
return DeprecatedString::formatted("<!--{}-->", node.get_deprecated("data"sv).as_string());
|
||||
if (type != "element")
|
||||
return node_name;
|
||||
|
||||
|
@ -161,7 +161,7 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
|||
builder.append('<');
|
||||
builder.append(node_name.to_lowercase());
|
||||
if (node.has("attributes"sv)) {
|
||||
auto attributes = node.get("attributes"sv).as_object();
|
||||
auto attributes = node.get_deprecated("attributes"sv).as_object();
|
||||
attributes.for_each_member([&builder](auto& name, JsonValue const& value) {
|
||||
builder.append(' ');
|
||||
builder.append(name);
|
||||
|
@ -180,7 +180,7 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
|||
void DOMTreeModel::map_dom_nodes_to_parent(JsonObject const* parent, JsonObject const* node)
|
||||
{
|
||||
m_dom_node_to_parent_map.set(node, parent);
|
||||
m_node_id_to_dom_node_map.set(node->get("id"sv).to_i32(), node);
|
||||
m_node_id_to_dom_node_map.set(node->get_deprecated("id"sv).to_i32(), node);
|
||||
|
||||
auto const* children = get_children(*node);
|
||||
if (!children)
|
||||
|
@ -204,7 +204,7 @@ GUI::ModelIndex DOMTreeModel::index_for_node(i32 node_id, Optional<Web::CSS::Sel
|
|||
if (!child.has("pseudo-element"sv))
|
||||
continue;
|
||||
|
||||
auto child_pseudo_element = child.get("pseudo-element"sv);
|
||||
auto child_pseudo_element = child.get_deprecated("pseudo-element"sv);
|
||||
if (!child_pseudo_element.is_i32())
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue