[Release]wrt-installer_0.1.6
[framework/web/wrt-installer.git] / tests / general / widgets / register_protocol_fail / hook.js
1 var id = "register02";
2
3 function hook(id, result, message){};
4
5 try {
6     try {
7         navigator.registerProtocolHandler("http", "?uri=%s", "Example http");
8         throw new Error("Exception not thrown!");
9     } catch (e) {
10         if (!(e instanceof DOMException) || e.code != 18 || e.name != "SECURITY_ERR") {
11             throw e;
12         }
13         document.getElementById('test').innerHTML = 'PASSED';
14         document.body.style.backgroundColor = 'green';
15         hook(id, 'pass', 'protocol handler not registered');
16     }
17 } catch (e) {
18     hook(id, 'fail', 'widget failed because ' + e.message);
19 }