falsandtru / pjax-api

The advanced PJAX superior to SPA.
https://falsandtru.github.io/pjax-api/
Apache License 2.0
318 stars 28 forks source link

fix: resolve issues under Firefox add-on context #45

Closed EnixCoda closed 4 years ago

EnixCoda commented 4 years ago

After #44 , add-ons won't crash during module initialization. However, I encountered other two issues when trying to redirect with pjax-api. Luckily, I managed to solve them by myself.

  1. SyntaxError: The URI is malformed. - XHR in add-on context need host fragment in URL to work properly. image

  2. NS_ERROR_UNEXPECTED - cloning Document failure. image

Please review for any cases I did not take care of.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 73.067% when pulling 26daf1e149db61c70c025eb8127f7ad5eb0327ae on EnixCoda:master into c1911056a3594927d9dc4e3f5e80450b7dfa123f on falsandtru:master.

falsandtru commented 4 years ago

Looks like your extension is using pjax on the host page. Since overriding the host page by pjax from third party tools almost certainly breaks the host page I don't support such usage.

EnixCoda commented 4 years ago
Since overriding the host page by pjax from third party tools almost certainly breaks the host page

I do agree with this point.

There is another thing to mention. GitHub officially uses PJAX to redirect, e.g. clicking on files/folders as shown below. You shall see a progress bar show at top and page re-renders without redirecting. If you look into the GitHub's source code and network activity, pjax is mentioned specifically there. So my extension is just adding more elements with PJAX turned on into a site already support PJAX.

image

Also, one of the functions extensions provide is extending the ability of the host page, like adding stuff into page as well as making those stuff work with pjax as host page elements do. So I believe PJAX usages of my extension is not that bad, right? :)


It's totally fine if you still disagree on pushing this PR forward. I do understand your concerns. 😄Please close it if you've made up your mind.

EnixCoda commented 4 years ago

Thanks for your patience on this anyway 😄

falsandtru commented 4 years ago

Unfortunately, injecting pjax breaks the state transition managed by the host page even when the host page uses pjax. On the host page, every developer of third party tools must use the page transition provided by the host.