- 必须使用跨全局的fetch函数, 例如.
let absolute = new URL(relative, window.location.href)
This is not a problem as such. It is just that different APIs that exhibit this kind of behavior were doing it inconsistently in the beavior defined in the spec, which could lead to problems further down the line.
In Firefox 60 onwards, Mozilla resolves the relative URL against the global that owns the
fetch() function being used (see bug 1432272). So in the case described above, it is resolved against the iframe's location:
let absolute = new URL(relative, frame.contentWindow.location.href)
There is a lot of discussion in progress about getting new specs to align with this behavior change, to mitigate potential problems going forward.