Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
App launch_paths must be relative to the origin (bug 753451)
  • Loading branch information
mattbasta committed Jun 29, 2012
1 parent a7b6258 commit 4e5b689
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 11 additions & 0 deletions tests/test_webapp.py
Expand Up @@ -328,6 +328,17 @@ def test_webapp_bad_launch_path():
_detect(err, data)
assert err.failed()

err = ErrorBundle(listed=False)
data["launch_path"] = "http://foo.com/bar"
_detect(err, data)
assert err.failed()

err = ErrorBundle(listed=False)
data["launch_path"] = "/foo/bar"
_detect(err, data)
assert not err.failed()



def test_webapp_widget_deprecated():
"""Test that the widget property is deprecated."""
Expand Down
9 changes: 6 additions & 3 deletions validator/webapp.py
Expand Up @@ -224,12 +224,15 @@ def test_webapp(err, webapp, current_valid_keys, required=True):
"must be a string.")
continue

if not test_path(webapp[key]):
if (not webapp[key].startswith("/") or
webapp[key].startswith("//")):
err.error(
err_id=("webapp", "detect", "launch_path"),
error="'launch_path' is not a valid path.",
description=["The 'launch_path' element is not a valid "
"path.",
description=["The `launch_path` element is not a valid "
"path. It must always be relative to the "
"origin of the domain that the manifest is "
"hosted on.",
"Bad path: %s" % webapp[key]])
elif key == "locales":
if "default_locale" not in webapp:
Expand Down

0 comments on commit 4e5b689

Please sign in to comment.