-
Notifications
You must be signed in to change notification settings - Fork 15.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom protocols #65
Conversation
zepto always fails when requesting custom protocols, 💩.
The WebKit only allows setting referrer for urls with |
Forgive my ignorance here, but I don't understand why the referrer header is required. Is it required to resolve relative URLs or something? |
it's required to resolve file paths in URLs with custom protocols, when writing something like |
Yeah, that makes sense. We could use the custom protocol only to resolve absolute references on the load path, but I think it would probably be better to traverse the ancestor directories looking for |
I'm not sure I understand the requirements. Can you give some examples of URLs and the file paths they should map to? |
We're looking for a coherent mechanism for referring to images and other static resources provided by third-party packages. I'm imagining that |
This is how I think the API would be like: var protocol = require('protocol');
protocol.registerProtocol('atom', function(url, referrer) {
// The url is 'atom://avatar.png',
// and the referrer is 'file:///Applications/Atom.app/.../index.html',
// Then we calculate the actual path to requested resource by traversing ancestor directories:
// '/Applications/Atom.app/.../avatar.png',
return new protocol.RequestFileJob(calculatePathFromUrlAndReferrer(url, referrer));
}); As for referrer, I just found that adding But another problem is, to resolve resource path like node's |
It seems really difficult (if not impossible?) to tie URL references in the DOM back to the class SomeView extends View
@content: -> @img src: @resolve('../images/flower.png') Could we add some kind of mechanism like |
@zcbenz After talking with Kevin the API you propose for registering a custom protocol from the JavaScript layer looks really good. Is it possible to provide a similar API to allow us to intercept relative |
Another thought: I wonder if it would improve performance to register callbacks that are associated with regular expressions? Then we can run the regular expression against the URL in the native layer and only call into JS if it matches a certain pattern. |
It's needed for interceptor API.
I found that the |
So the devtools' |
After some explores on implementing the
The 1 is simple, the 2 can be implemented but needs small patches on Chromium, the 3 seems impossible, and the 4 needs big patches on Chromium. Now I give up on this feature and stick to current API. |
Focus on devtools when it is opened on Mac.
Focus on devtools when it is opened on Mac.
Hi, guys! Do we plan to support |
API to control the cache of each request.Provide information of from where the request is made (not sure if it's possible).