| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <body> | 2 <body> |
| 3 <p>Test IsProviderInstalled.<p> | 3 <p>Test IsProviderInstalled.<p> |
| 4 <div id=result> | 4 <div id=result> |
| 5 </div> | 5 </div> |
| 6 <script> | 6 <script> |
| 7 var passedAll = true; | 7 var passedAll = true; |
| 8 | 8 |
| 9 function log(message) { | 9 function log(message) { |
| 10 document.getElementById("result").innerHTML += message + "<br>"; | 10 document.getElementById("result").innerHTML += message + "<br>"; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 document.location.protocol == "http:" ? "https:" : "http:"; | 45 document.location.protocol == "http:" ? "https:" : "http:"; |
| 46 var differentPort = | 46 var differentPort = |
| 47 (!document.location.port || document.location.port == "80") ? ":81" : ":80
"; | 47 (!document.location.port || document.location.port == "80") ? ":81" : ":80
"; |
| 48 | 48 |
| 49 var origin = document.location.protocol + "//" + document.location.host + "/"; | 49 var origin = document.location.protocol + "//" + document.location.host + "/"; |
| 50 var originWithDifferentProtocol = differentProtocol + "//" + | 50 var originWithDifferentProtocol = differentProtocol + "//" + |
| 51 document.location.host + "/"; | 51 document.location.host + "/"; |
| 52 var originWithDifferentPort = document.location.protocol + "//" + | 52 var originWithDifferentPort = document.location.protocol + "//" + |
| 53 document.location.hostname + differentPort + "/"; | 53 document.location.hostname + differentPort + "/"; |
| 54 | 54 |
| 55 // Verify existance of the api. | 55 // Verify existence of the api. |
| 56 var foundApi = false; | 56 var foundApi = false; |
| 57 try { | 57 try { |
| 58 if (window.external.IsSearchProviderInstalled) | 58 if (window.external.IsSearchProviderInstalled) |
| 59 foundApi = true; | 59 foundApi = true; |
| 60 } catch (e) { | 60 } catch (e) { |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (foundApi) | 63 if (foundApi) |
| 64 logPassed("IsSearchProvider api exists."); | 64 logPassed("IsSearchProvider api exists."); |
| 65 else { | 65 else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 76 else | 76 else |
| 77 logFailed(installedMessage + " The expected result is passed as the hash."); | 77 logFailed(installedMessage + " The expected result is passed as the hash."); |
| 78 | 78 |
| 79 // Verify that cases that should result in exceptions. | 79 // Verify that cases that should result in exceptions. |
| 80 verifyExceptionFor("different host", "http://example.org/"); | 80 verifyExceptionFor("different host", "http://example.org/"); |
| 81 verifyExceptionFor("different protocol", originWithDifferentProtocol); | 81 verifyExceptionFor("different protocol", originWithDifferentProtocol); |
| 82 verifyExceptionFor("different port", originWithDifferentPort); | 82 verifyExceptionFor("different port", originWithDifferentPort); |
| 83 | 83 |
| 84 writeResult(); | 84 writeResult(); |
| 85 } catch (e) { | 85 } catch (e) { |
| 86 logFailed("An exception occurred. Name: " + e.name + " Message: " + e.message)
; | 86 logFailed("An exception occurred. Name: " + e.name + " Message: " + |
| 87 e.message); |
| 87 writeResult(); | 88 writeResult(); |
| 88 } | 89 } |
| 89 </script> | 90 </script> |
| 90 </body> | 91 </body> |
| 91 </html> | 92 </html> |
| OLD | NEW |