зеркало из https://github.com/mozilla/gecko-dev.git
Bug 957893 - RequireWakeLock should not crash when the param is an empty string, r=ehsan
This commit is contained in:
Родитель
600b388d03
Коммит
53bdd2dbc1
|
@ -1143,10 +1143,12 @@ Navigator::RequestWakeLock(const nsAString &aTopic, ErrorResult& aRv)
|
|||
power::PowerManagerService::GetInstance();
|
||||
// Maybe it went away for some reason... Or maybe we're just called
|
||||
// from our XPCOM method.
|
||||
NS_ENSURE_TRUE(pmService, nullptr);
|
||||
if (!pmService) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
return pmService->NewWakeLock(aTopic, mWindow, rv);
|
||||
return pmService->NewWakeLock(aTopic, mWindow, aRv);
|
||||
}
|
||||
|
||||
nsIDOMMozMobileMessageManager*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[DEFAULT]
|
||||
|
||||
[test_bug957893.html]
|
||||
[test_bug957899.html]
|
||||
[test_power_basics.html]
|
||||
[test_power_set_cpusleepallowed.html]
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test bug 957893 - Crash in WakeLock</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
try {
|
||||
var wl = navigator.requestWakeLock('');
|
||||
ok(false, "RequestWakeLock throws an exception!");
|
||||
} catch(e) {
|
||||
ok(true, "RequestWakeLock throws an exception!");
|
||||
}
|
||||
|
||||
info("Still alive!");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче