Propagate the source origin as much as possible
[WebKit-https.git] / JSTests / stress / source-origin.js
1 function shouldBe(actual, expected) {
2     if (actual !== expected)
3         throw new Error('bad value: ' + actual);
4 }
5
6 shouldBe(callerSourceOrigin().endsWith('source-origin.js'), true);
7 shouldBe([ 0 ].map(callerSourceOrigin)[0].endsWith('source-origin.js'), true);
8 shouldBe(eval(`callerSourceOrigin()`).endsWith('source-origin.js'), true);
9 shouldBe((0, eval)(`callerSourceOrigin()`).endsWith('source-origin.js'), true);
10 shouldBe((new Function(`return callerSourceOrigin()`))().endsWith('source-origin.js'), true);
11 shouldBe((Function(`return callerSourceOrigin()`))().endsWith('source-origin.js'), true);