OLD | NEW |
| (Empty) |
1 /** | |
2 * @license | |
3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | |
4 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt | |
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt | |
6 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt | |
7 * Code distributed by Google as part of the polymer project is also | |
8 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt | |
9 */ | |
10 | |
11 // if standalone | |
12 if (window.top === window) { | |
13 // if standalone | |
14 var failed = false; | |
15 window.done = function() { | |
16 window.onerror = null; | |
17 if (!failed) { | |
18 var d = document.createElement('pre'); | |
19 d.style.cssText = 'padding: 6px; background-color: lightgreen;'; | |
20 d.textContent = 'Passed'; | |
21 document.body.appendChild(d); | |
22 } | |
23 }; | |
24 window.onerror = function(x) { | |
25 failed = true; | |
26 var d = document.createElement('pre'); | |
27 d.style.cssText = 'padding: 6px; background-color: #FFE0E0;'; | |
28 d.textContent = 'FAILED: ' + x; | |
29 document.body.appendChild(d); | |
30 }; | |
31 } else | |
32 // if part of a test suite | |
33 { | |
34 window.done = function() { | |
35 window.onerror = null; | |
36 parent.postMessage('ok', '*'); | |
37 }; | |
38 | |
39 window.onerror = function(x) { | |
40 parent.postMessage({error: x}, '*'); | |
41 }; | |
42 } | |
43 | |
OLD | NEW |