Skip to content
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

The behavior of usercss installation page #348

Closed
eight04 opened this issue Feb 15, 2018 · 2 comments
Closed

The behavior of usercss installation page #348

eight04 opened this issue Feb 15, 2018 · 2 comments

Comments

@eight04
Copy link
Collaborator

eight04 commented Feb 15, 2018

  • Browser: Firefox 59.0b9
  • Operating System: Windows 7
  • Screenshot:

This is not related to OUCSS.

Example URL:
https://raw.githubusercontent.com/RaitaroH/YouTube-DeepDark/master/YouTubeDeepDarkMaterial.user.css

IIRC, when #134 is implemented:

  • When left-clicking on the link

    1. Open source code page in the current tab.
    2. Open installation page in a new tab.
    3. Click install.
    4. Open editor in a new tab.
    5. Source code page goes backward.
    6. Installation page is closed (due to port disconnection).

    Result in 2 tabs:

    • This issue.
    • The editor.
  • When middle-clicking on the link

    1. Open source code page in a new tab.
    2. Open installation page in a new tab.
    3. Click install.
    4. Open editor in a new tab.
    5. Source code page is closed.
    6. Installation page is closed (due to port disconnection).

    Result in 2 tabs:

    • This issue.
    • The editor.

Current behavior:

  • When left-clicking on the link

    1. Open source code page in the current tab.
    2. Open installation page in a new tab.
    3. Click install.
    4. Installation page becomes the editor.

    Result in 2 tabs:

    • The source code page.
    • The editor.
  • When middle-clicking on the link

    1. Open source code page in a new tab.
    2. Open installation page in a new tab.
    3. Click install.
    4. Installation page becomes the editor.

    Result in 3 tabs:

    • This issue.
    • The source code page.
    • The editor.

In the new version, the source code page is left in the window/tab, which is caused by aedb02b#diff-e0e82cc2f07995a5e5771a1cf2a8a8c1R190.

-      port.postMessage({method: 'closeTab'});
+      chrome.runtime.sendMessage({method: 'closeTab'});

I think it is an accident because port.postMessage({method: 'closeTab'}) closes the source code tab but chrome.runtime.sendMessage({method: 'closeTab'}); closes the installation tab, and the closeTab handler in content/install-hook-usercss.js is not removed.

Also, in the current version, the installation tab is not closed after closing the source code tab.

@tophf
Copy link
Member

tophf commented Feb 15, 2018

It's not an accident. Like I said, it's working as intended. The reason is to preserve user navigation. I can understand why you implemented history back/closing of the source tab, but I think the old behavior was wrong: if a user navigation was performed by the browser and the page was actually shown, we should not navigate back nor close it. AFAIK Chrome Webstore even has a policy about extensions that behave this way.

Ideally, we should have used webRequest API to redirect the URL to our installer page like Tampermonkey does, but I don't want to add a new permission just for this purpose.

@tophf tophf closed this as completed Feb 15, 2018
@eight04
Copy link
Collaborator Author

eight04 commented Feb 15, 2018

If it is not an accident, the closeTab handler should be removed.

in the current version, the installation tab is not closed after closing the source code tab.

This might be a bug in Firefox. I can't reproduce it in Chrome.

tophf added a commit that referenced this issue Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants