aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/scenario/Application.js8
-rw-r--r--src/scenario/Scenario.js12
2 files changed, 15 insertions, 5 deletions
diff --git a/src/scenario/Application.js b/src/scenario/Application.js
index eacf3c7b..9d05aad0 100644
--- a/src/scenario/Application.js
+++ b/src/scenario/Application.js
@@ -41,7 +41,7 @@ angular.scenario.Application.prototype.getWindow_ = function() {
* Checks that a URL would return a 2xx success status code. Callback is called
* with no arguments on success, or with an error on failure.
*
- * Warning: This requires the server to be able to respond to HEAD requests
+ * Warning: This requires the server to be able to respond to HEAD requests
* and not modify the state of your application.
*
* @param {string} url Url to check
@@ -69,7 +69,7 @@ angular.scenario.Application.prototype.checkUrlStatus_ = function(url, callback)
/**
* Changes the location of the frame.
*
- * @param {string} url The URL. If it begins with a # then only the
+ * @param {string} url The URL. If it begins with a # then only the
* hash of the page is changed.
* @param {Function} loadFn function($window, $document) Called when frame loads.
* @param {Function} errorFn function(error) Called if any error when loading.
@@ -79,8 +79,8 @@ angular.scenario.Application.prototype.navigateTo = function(url, loadFn, errorF
var frame = this.getFrame_();
//TODO(esprehn): Refactor to use rethrow()
errorFn = errorFn || function(e) { throw e; };
- if (/^file:\/\//.test(url)) {
- errorFn('Sandbox Error: Cannot load file:// URL.');
+ if (url === 'about:blank') {
+ errorFn('Sandbox Error: Navigating to about:blank is not allowed.');
} else if (url.charAt(0) === '#') {
url = frame.attr('src').split('#')[0] + url;
frame.attr('src', url);
diff --git a/src/scenario/Scenario.js b/src/scenario/Scenario.js
index d141c42b..fc7150bc 100644
--- a/src/scenario/Scenario.js
+++ b/src/scenario/Scenario.js
@@ -93,6 +93,7 @@ angular.scenario.matcher = angular.scenario.matcher || function(name, fn) {
* @param {Object} config Config options
*/
function angularScenarioInit($scenario, config) {
+ var href = window.location.href;
var body = _jQuery(document.body);
var output = [];
@@ -108,6 +109,15 @@ function angularScenarioInit($scenario, config) {
}
});
+ if (!/^http/.test(href) && !/^https/.test(href)) {
+ body.append('<p id="system-error"></p>');
+ body.find('#system-error').text(
+ 'Scenario runner must be run using http or https. The protocol ' +
+ href.split(':')[0] + ':// is not supported.'
+ );
+ return;
+ }
+
var appFrame = body.append('<div id="application"></div>').find('#application');
var application = new angular.scenario.Application(appFrame);
@@ -134,7 +144,7 @@ function angularScenarioInit($scenario, config) {
*
* @param {Array} list list to iterate over
* @param {Function} iterator Callback function(value, continueFunction)
- * @param {Function} done Callback function(error, result) called when
+ * @param {Function} done Callback function(error, result) called when
* iteration finishes or an error occurs.
*/
function asyncForEach(list, iterator, done) {