Skip to content
Permalink
Browse files
  • Loading branch information
purplecabbage committed Oct 9, 2014
2 parents 471ab59 + 71c7c56 commit 5949f4e71fcec74883565e286ccc190c357b945a
Showing 1 changed file with 22 additions and 14 deletions.
@@ -20,18 +20,26 @@
*/

describe('Bridge', function() {
if (cordova.platformId == 'android') {
it("bridge.spec.1 should reject bridge from iframe with data: URL", function() {
var ifr = document.createElement('iframe');
var done = false;
ifr.src = 'data:text/html,';
ifr.onload = function() {
var stolenSecret = ifr.contentWindow.prompt('', 'gap_init:');
done = true;
expect(!!stolenSecret).toBe(false);
};
document.body.appendChild(ifr);
waitsFor(function() { return done; });
});
}

// Adding this spec is the way to show some useful information to user
// and to avoid failure of test framework (see CB-7491)
it("bridge spec will run on android only", function() {

expect(cordova.platformId).toBe('android');

if (cordova.platformId == 'android') {
it("bridge.spec.1 should reject bridge from iframe with data: URL", function() {
var ifr = document.createElement('iframe');
var done = false;
ifr.src = 'data:text/html,';
ifr.onload = function() {
var stolenSecret = ifr.contentWindow.prompt('', 'gap_init:');
done = true;
expect(!!stolenSecret).toBe(false);
};
document.body.appendChild(ifr);
waitsFor(function() { return done; });
});
}
});
});

0 comments on commit 5949f4e

Please sign in to comment.