Opened 11 years ago
Last modified 10 years ago
#11277 closed defect
Unexpected results using Href with network-path references — at Initial Version
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | 1.0.2 |
Component: | general | Version: | 1.1.1dev |
Severity: | minor | Keywords: | patch, http link uri url |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
During the last years network-path references are used more often due to the popularity of CDN solutions, the deployment of http/https/spdy/… and some issues in browsers (particularly MSIE) when switching to a different scheme to retrieve linked resources.
When trying to use add_script
(or similar) function with network-path references this is what I get
>>> from wsgiref.util import setup_testing_defaults >>> environ = {} >>> setup_testing_defaults(environ) >>> from trac.web.api import Request >>> req = Request(environ, lambda *args, **kwargs: None) >>> req.locale = None >>> from trac.env import open_environment as oe >>> env = oe('/srv/trac/cleanmp') >>> from trac.web.chrome import Chrome >>> from trac.web import chrome >>> req.callbacks['chrome'] = chrome.Chrome(env).prepare_request >>> chrome.add_script(req, '//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js') >>> from pprint import pprint >>> pprint(req.chrome['scripts']) [{'charset': 'utf-8', 'href': '/chrome/common/js/jquery.js', 'prefix': None, 'suffix': None, 'type': 'text/javascript'}, {'charset': 'utf-8', 'href': '/chrome/common/js/babel.js', 'prefix': None, 'suffix': None, 'type': 'text/javascript'}, {'charset': 'utf-8', 'href': '/chrome/common/js/trac.js', 'prefix': None, 'suffix': None, 'type': 'text/javascript'}, {'charset': 'utf-8', 'href': '/chrome/common/js/search.js', 'prefix': None, 'suffix': None, 'type': 'text/javascript'}, {'charset': 'utf-8', 'href': '/ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js', 'prefix': None, 'suffix': None, 'type': 'text/javascript'}]
As can be seen it will not be expanded correctly.
N.B. Version in /trunk is 1.1.2 but I did not see such option in versions selector .