зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1680377 - Follow-up fixes to WebGPU error scope
addressing post-landing review notes of https://phabricator.services.mozilla.com/D118741 Differential Revision: https://phabricator.services.mozilla.com/D119654
This commit is contained in:
Родитель
7f684896cb
Коммит
504ad98a7b
|
@ -35,11 +35,13 @@ class ErrorBuffer {
|
|||
return errorBuf;
|
||||
}
|
||||
|
||||
bool CheckError() {
|
||||
Maybe<nsCString> GetError() {
|
||||
mGuard = false;
|
||||
return mUtf8[0] != 0;
|
||||
if (!mUtf8[0]) {
|
||||
return Nothing();
|
||||
}
|
||||
return Some(nsCString(mUtf8));
|
||||
}
|
||||
nsDependentCString GetError() const { return nsDependentCString(mUtf8); };
|
||||
};
|
||||
|
||||
class PresentationData {
|
||||
|
@ -207,22 +209,21 @@ void WebGPUParent::MaintainDevices() {
|
|||
|
||||
bool WebGPUParent::ForwardError(RawId aDeviceId, ErrorBuffer& aError) {
|
||||
// don't do anything if the error is empty
|
||||
if (!aError.CheckError()) {
|
||||
auto cString = aError.GetError();
|
||||
if (!cString) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto cString = aError.GetError();
|
||||
|
||||
// find the appropriate error scope
|
||||
const auto& lookup = mErrorScopeMap.find(aDeviceId);
|
||||
if (lookup != mErrorScopeMap.end() && !lookup->second.mStack.IsEmpty()) {
|
||||
auto& last = lookup->second.mStack.LastElement();
|
||||
if (last.isNothing()) {
|
||||
last.emplace(ScopedError{false, std::move(cString)});
|
||||
last.emplace(ScopedError{false, cString.value()});
|
||||
}
|
||||
} else {
|
||||
// fall back to the uncaptured error handler
|
||||
if (!SendDeviceUncapturedError(aDeviceId, cString)) {
|
||||
if (!SendDeviceUncapturedError(aDeviceId, cString.value())) {
|
||||
NS_ERROR("Unable to SendError");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ const func = async function() {
|
|||
await device.popErrorScope();
|
||||
ok(false, "Should have thrown")
|
||||
} catch (ex) {
|
||||
ok(ex instanceof OperationError, "Should throw an OperationError")
|
||||
ok(ex.name == 'OperationError', "Should throw an OperationError")
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче