Skip to content

Commit e621dc9

Browse files
Guy Bedfordelliottt
andauthored
StarlingMonkey WPT tests (#810)
Co-authored-by: Trevor Elliott <[email protected]>
1 parent 7bd1580 commit e621dc9

File tree

8 files changed

+27
-24
lines changed

8 files changed

+27
-24
lines changed

.github/workflows/starlingmonkey.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
if: steps.cache-crate.outputs.cache-hit != 'true'
5858

5959
run_wpt:
60-
if: github.ref != 'refs/heads/main' && false
60+
if: github.ref != 'refs/heads/main'
6161
name: Run Web Platform Tests
6262
needs: [build, ensure_cargo_installs]
6363
runs-on: ubuntu-latest
@@ -107,7 +107,7 @@ jobs:
107107
108108
- name: Run tests
109109
timeout-minutes: 20
110-
run: node ./tests/wpt-harness/run-wpt.mjs --starlingmonkey -vv
110+
run: node ./tests/wpt-harness/run-wpt.mjs -vv
111111

112112
sdktest:
113113
if: github.ref != 'refs/heads/main'

runtime/fastly/builtins/fetch/request-response.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,9 +2879,7 @@ bool Response::constructor(JSContext *cx, unsigned argc, JS::Value *vp) {
28792879
return false;
28802880
}
28812881
if (!statusText_val.isUndefined()) {
2882-
auto statusText_str = core::encode(cx, statusText_val);
2883-
std::string s(statusText_str.ptr.get(), statusText_str.len);
2884-
auto status_text_result = convertJSValueToByteString(cx, s);
2882+
auto status_text_result = convertJSValueToByteString(cx, statusText_val);
28852883
if (status_text_result.isErr()) {
28862884
JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr,
28872885
JSMSG_RESPONSE_CONSTRUCTOR_INVALID_STATUS_TEXT);

runtime/fastly/handler.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "../StarlingMonkey/builtins/web/performance.h"
12
#include "./builtins/fetch-event.h"
23
#include "./host-api/fastly.h"
34
#include "./host-api/host_api_fastly.h"
@@ -14,14 +15,16 @@ namespace fastly::runtime {
1415

1516
api::Engine *ENGINE;
1617

18+
// Install corresponds to Wizer time, so we configure the engine here
1719
bool install(api::Engine *engine) {
1820
ENGINE = engine;
21+
engine->enable_module_mode(false);
1922
return true;
2023
}
2124

2225
void handle_incoming(host_api::Request req) {
23-
// TODO(GB): reimplement
24-
// builtins::Performance::timeOrigin.emplace(std::chrono::high_resolution_clock::now());
26+
builtins::web::performance::Performance::timeOrigin.emplace(
27+
std::chrono::high_resolution_clock::now());
2528

2629
double total_compute = 0;
2730
auto start = system_clock::now();

runtime/fastly/host-api/host_api.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ void sleep_until(uint64_t time_ns, uint64_t now) {
3333
}
3434
}
3535

36-
size_t api::AsyncTask::select(std::vector<api::AsyncTask *> *tasks) {
37-
size_t tasks_len = tasks->size();
36+
size_t api::AsyncTask::select(std::vector<api::AsyncTask *> &tasks) {
37+
size_t tasks_len = tasks.size();
3838
std::vector<fastly_compute_at_edge_async_io_handle_t> handles;
3939
handles.reserve(tasks_len);
4040
uint64_t now = 0;
4141
uint64_t soonest_deadline = 0;
4242
size_t soonest_deadline_idx = -1;
4343
for (size_t idx = 0; idx < tasks_len; ++idx) {
44-
auto *task = tasks->at(idx);
44+
auto *task = tasks.at(idx);
4545
uint64_t deadline = task->deadline();
4646
// Select for completed task deadlines before performing the task select host call.
4747
if (deadline > 0) {
@@ -86,7 +86,7 @@ size_t api::AsyncTask::select(std::vector<api::AsyncTask *> *tasks) {
8686
// non-timer task.
8787
size_t task_idx = 0;
8888
for (size_t idx = 0; idx < tasks_len; ++idx) {
89-
if (tasks->at(idx)->id() != NEVER_HANDLE) {
89+
if (tasks.at(idx)->id() != NEVER_HANDLE) {
9090
if (ret.val == task_idx) {
9191
return idx;
9292
}
@@ -1819,11 +1819,13 @@ const std::optional<std::string> FastlySendError::message() const {
18191819
/// The system encountered a DNS error when trying to find an IP address for the backend
18201820
/// hostname. The fields dns_error_rcode and dns_error_info_code may be set in the
18211821
/// send_error_detail.
1822-
// TODO(GB): reenable DNS error codes
18231822
case dns_error: {
1824-
return "DNS error (rcode={}, info_code={})" /*, this->dns_error_rcode,
1825-
this->dns_error_info_code*/
1826-
;
1823+
// allocate maximum len of error message
1824+
char buf[34 + 10 + 1];
1825+
int written = snprintf(buf, sizeof(buf), "DNS error (rcode=%d, info_code=%d)",
1826+
this->dns_error_rcode, this->dns_error_info_code);
1827+
MOZ_ASSERT(written > 34);
1828+
return std::string(buf, written);
18271829
}
18281830
/// The system cannot determine which backend to use, or the specified backend was invalid.
18291831
case destination_not_found: {

runtime/js-compute-runtime/rust-url/Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/js-compute-runtime/rust-url/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
crate-type = ["staticlib"]
88

99
[dependencies]
10-
url = "2.5.0"
10+
url = "2.5.2"
1111

1212
[profile.release]
1313
lto = true

tests/wpt-harness/expectations/url/url-setters.any.js.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@
564564
"status": "PASS"
565565
},
566566
"URL: Setting <foo://somehost/some/path>.pathname = '' Non-special URLs can have their paths erased": {
567-
"status": "FAIL"
567+
"status": "PASS"
568568
},
569569
"URL: Setting <foo:///some/path>.pathname = '' Non-special URLs with an empty host can have their paths erased": {
570570
"status": "FAIL"

0 commit comments

Comments
 (0)