mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Update web-platform-tests to revision b'ee6da9d71d0268d7fdb04e8e5b26858f46ee0cc4'
This commit is contained in:
parent
4401622eb1
commit
b77ad115f6
16832 changed files with 270819 additions and 87621 deletions
|
@ -139,8 +139,10 @@ self.WebNFCTest = (() => {
|
|||
this.hw_status_ = NFCHWStatus.ENABLED;
|
||||
this.pushed_message_ = null;
|
||||
this.pending_write_options_ = null;
|
||||
this.pending_promise_func_ = null;
|
||||
this.pending_push_promise_func_ = null;
|
||||
this.push_completed_ = true;
|
||||
this.pending_make_read_only_promise_func_ = null;
|
||||
this.make_read_only_completed_ = true;
|
||||
this.client_ = null;
|
||||
this.watchers_ = [];
|
||||
this.reading_messages_ = [];
|
||||
|
@ -152,11 +154,11 @@ self.WebNFCTest = (() => {
|
|||
|
||||
// NFC delegate functions.
|
||||
async push(message, options) {
|
||||
let error = this.getHWError();
|
||||
const error = this.getHWError();
|
||||
if (error)
|
||||
return error;
|
||||
// Cancels previous pending push operation.
|
||||
if (this.pending_promise_func_) {
|
||||
if (this.pending_push_promise_func_) {
|
||||
this.cancelPendingPushOperation();
|
||||
}
|
||||
|
||||
|
@ -165,7 +167,7 @@ self.WebNFCTest = (() => {
|
|||
return new Promise(resolve => {
|
||||
if (this.operations_suspended_ || !this.push_completed_) {
|
||||
// Leaves the push pending.
|
||||
this.pending_promise_func_ = resolve;
|
||||
this.pending_push_promise_func_ = resolve;
|
||||
} else if (this.is_formatted_tag_ && !options.overwrite) {
|
||||
// Resolves with NotAllowedError if there are NDEF records on the device
|
||||
// and overwrite is false.
|
||||
|
@ -184,13 +186,40 @@ self.WebNFCTest = (() => {
|
|||
return createNDEFError(null);
|
||||
}
|
||||
|
||||
async makeReadOnly(options) {
|
||||
const error = this.getHWError();
|
||||
if (error)
|
||||
return error;
|
||||
// Cancels previous pending makeReadOnly operation.
|
||||
if (this.pending_make_read_only_promise_func_) {
|
||||
this.cancelPendingMakeReadOnlyOperation();
|
||||
}
|
||||
|
||||
if (this.operations_suspended_ || !this.make_read_only_completed_) {
|
||||
// Leaves the makeReadOnly pending.
|
||||
return new Promise(resolve => {
|
||||
this.pending_make_read_only_promise_func_ = resolve;
|
||||
});
|
||||
} else if (this.data_transfer_failed_) {
|
||||
// Resolves with NetworkError if data transfer fails.
|
||||
return createNDEFError(NDEFErrorType.IO_ERROR);
|
||||
} else {
|
||||
return createNDEFError(null);
|
||||
}
|
||||
}
|
||||
|
||||
async cancelMakeReadOnly() {
|
||||
this.cancelPendingMakeReadOnlyOperation();
|
||||
return createNDEFError(null);
|
||||
}
|
||||
|
||||
setClient(client) {
|
||||
this.client_ = client;
|
||||
}
|
||||
|
||||
async watch(id) {
|
||||
assert_true(id > 0);
|
||||
let error = this.getHWError();
|
||||
const error = this.getHWError();
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
|
@ -245,22 +274,27 @@ self.WebNFCTest = (() => {
|
|||
this.push_completed_ = result;
|
||||
}
|
||||
|
||||
setPendingMakeReadOnlyCompleted(result) {
|
||||
this.make_read_only_completed_ = result;
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.hw_status_ = NFCHWStatus.ENABLED;
|
||||
this.watchers_ = [];
|
||||
this.reading_messages_ = [];
|
||||
this.operations_suspended_ = false;
|
||||
this.cancelPendingPushOperation();
|
||||
this.cancelPendingMakeReadOnlyOperation();
|
||||
this.is_formatted_tag_ = false;
|
||||
this.data_transfer_failed_ = false;
|
||||
this.should_close_pipe_on_request_ = false;
|
||||
}
|
||||
|
||||
cancelPendingPushOperation() {
|
||||
if (this.pending_promise_func_) {
|
||||
this.pending_promise_func_(
|
||||
if (this.pending_push_promise_func_) {
|
||||
this.pending_push_promise_func_(
|
||||
createNDEFError(NDEFErrorType.OPERATION_CANCELLED));
|
||||
this.pending_promise_func_ = null;
|
||||
this.pending_push_promise_func_ = null;
|
||||
}
|
||||
|
||||
this.pushed_message_ = null;
|
||||
|
@ -268,6 +302,16 @@ self.WebNFCTest = (() => {
|
|||
this.push_completed_ = true;
|
||||
}
|
||||
|
||||
cancelPendingMakeReadOnlyOperation() {
|
||||
if (this.pending_make_read_only_promise_func_) {
|
||||
this.pending_make_read_only_promise_func_(
|
||||
createNDEFError(NDEFErrorType.OPERATION_CANCELLED));
|
||||
this.pending_make_read_only_promise_func_ = null;
|
||||
}
|
||||
|
||||
this.make_read_only_completed_ = true;
|
||||
}
|
||||
|
||||
// Sets message that is used to deliver NFC reading updates.
|
||||
setReadingMessage(message) {
|
||||
this.reading_messages_.push(message);
|
||||
|
@ -303,9 +347,15 @@ self.WebNFCTest = (() => {
|
|||
}
|
||||
}
|
||||
// Resumes pending push operation.
|
||||
if (this.pending_promise_func_ && this.push_completed_) {
|
||||
this.pending_promise_func_(createNDEFError(null));
|
||||
this.pending_promise_func_ = null;
|
||||
if (this.pending_push_promise_func_ && this.push_completed_) {
|
||||
this.pending_push_promise_func_(createNDEFError(null));
|
||||
this.pending_push_promise_func_ = null;
|
||||
}
|
||||
// Resumes pending makeReadOnly operation.
|
||||
if (this.pending_make_read_only_promise_func_ &&
|
||||
this.make_read_only_completed_) {
|
||||
this.pending_make_read_only_promise_func_(createNDEFError(null));
|
||||
this.pending_make_read_only_promise_func_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,10 +369,16 @@ self.WebNFCTest = (() => {
|
|||
});
|
||||
}
|
||||
// Reject the pending push with NotSupportedError.
|
||||
if (this.pending_promise_func_) {
|
||||
this.pending_promise_func_(
|
||||
if (this.pending_push_promise_func_) {
|
||||
this.pending_push_promise_func_(
|
||||
createNDEFError(NDEFErrorType.NOT_SUPPORTED));
|
||||
this.pending_promise_func_ = null;
|
||||
this.pending_push_promise_func_ = null;
|
||||
}
|
||||
// Reject the pending makeReadOnly with NotSupportedError.
|
||||
if (this.pending_make_read_only_promise_func_) {
|
||||
this.pending_make_read_only_promise_func_(
|
||||
createNDEFError(NDEFErrorType.NOT_SUPPORTED));
|
||||
this.pending_make_read_only_promise_func_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue