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

[WINDOWS ONLY?] Source url is replaced by file:///tmp/* when installing from "Show sript source" #2348

Closed
gwarser opened this issue Jan 6, 2016 · 20 comments
Milestone

Comments

@gwarser
Copy link

gwarser commented Jan 6, 2016

User scripts may be installed by clicking on "install" button in "Greasemonkey installation" window or by clicking "Show script source" and then "Install script".
When using first way all is ok.
When using second way, script url is changed to file:///tmp/gm-temp/script-name and:

  • When @namespace is missing, script will be installed second time. example
  • When @namespace is present, but @updateURL is missing, previously installed script may be overwritten with wrong metadata - wrong update URL pointing to file:///tmp/gm-temp/script-name example

Linux Mint 17.2, Firefox 45a2, Greasemonkey 3.6.

@janekptacijarabaci
Copy link
Contributor

AFAIK: This is how it works.

When using first way all is ok.

namespace = aUri.host
(https://github.com/greasemonkey/greasemonkey/blob/3.6/modules/parseScript.js#L33)

When using second way, script url is changed to file:///tmp/gm-temp/script-name

and...

When @namespace is missing, script will be installed second time.

namespace = ""
(file:/// => the host is omitted => aUri.host is empty)

oldScript_namespace != newScript_namespace
=> oldScript_id != newScript_id

When @namespace is present, but @updateURL is missing, previously installed script may be overwritten with wrong metadata - wrong update URL pointing to file:///tmp/gm-temp/script-name

oldScript_namespace == newScript_namespace && oldScript_name == newScript_name
=> oldScript_id == newScript_id

file://[anything] (copying *.user.js files by using (e.g.) the drag-and-drop method) => "Show script source" and then "Install script". The result will be the same (@updateURL=file:///tmp/gm-temp/script-name).

@arantius
Copy link
Collaborator

arantius commented Jan 7, 2016

Showing the temp file is an intentional security feature: so the site cannot possibly play tricks by serving (e.g.) a different script to the request for the one that can be installed vs. the one that can be viewed. Download first, then display if requested.

Looks like the rest is a bug caused by not remembering the original URL.

@arantius
Copy link
Collaborator

This only reproduces with e10s on.

@arantius
Copy link
Collaborator

This should be fixed in 3.7beta2: https://addons.mozilla.org/firefox/downloads/file/388504/greasemonkey-3.7beta2-fx.xpi?src=devhub

I'd appreciate confirmation either way.

@janekptacijarabaci
Copy link
Contributor

Also on e10s off.

IMHO: Now it works strange...

  1. The example:
    https://github.com/anonim1133/wykop-userjs/blob/a86014414395f71e2b9f930cf8ec876374808c24/wykop-zawijas.user.js

Raw -> No notification bars (ad 5808f27#diff-cc9068ae2f4d364d46afc036f489eb89R205 - see also #2280)

  1. The example:
    https://raw.githubusercontent.com/anonim1133/wykop-userjs/a86014414395f71e2b9f930cf8ec876374808c24/wykop-zawijas.user.js

e10s on:
Show source code -> The notification bar is seen, but it soon disappears

e10s off:
Show source code -> The notification bar is seen, but it soon disappears

See also https://github.com/janekptacijarabaci/greasemonkey/tree/showSriptSource_notificationBox - after this test patch:

e10s on:
Show source code -> The notification bar is seen

e10s off:
Show source code -> The notification bar is seen

Edit: I've simplified it a bit...

@gwarser
Copy link
Author

gwarser commented Jan 21, 2016

On Greasyfork, middle clicking 'Install this script' button, opens two 'Greasemonkey Installation' windows.

@arantius arantius reopened this Jan 21, 2016
@janekptacijarabaci
Copy link
Contributor

On Greasyfork, middle clicking 'Install this script' button, opens two 'Greasemonkey Installation' windows.

Confirmed with e10s disabled.
...but not associated with a commit: 5808f27#diff-cc9068ae2f4d364d46afc036f489eb89R205

@arantius
Copy link
Collaborator

Double install box: confirmed, but only with e10s disabled.

@janekptacijarabaci I can't confirm anything you said above, except the separate issue #2280.

@janekptacijarabaci
Copy link
Contributor

Not confirmed on:
Ubuntu 15.10
Firefox Nightly 46.0a1 (2016-01-21) x64
GM 3.7beta2

Confirmed on:
Windows 7/8.1/10
Firefox 38.0
Firefox 43.0
Firefox Nightly 46.0a1 (2016-01-20) x32
Firefox Nightly 46.0a1 (2016-01-21) x64
GM 3.7beta2

:-) ... :-/


Edit
(ad "The notification bar is seen, but it soon disappears")

Last good: Firefox 29.0 Beta 1
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
Built from https://hg.mozilla.org/releases/mozilla-beta/rev/904eb7fb178c

First bad: Firefox 29.0 Beta 2
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
Built from https://hg.mozilla.org/releases/mozilla-beta/rev/fceb90d30601

Pushlog
http://hg.mozilla.org/releases/mozilla-beta/pushloghtml?fromchange=904eb7fb178c&tochange=fceb90d30601

Bug 982993 is the suspect (maybe).

@gwarser
Copy link
Author

gwarser commented Jan 21, 2016

Yes, this was on Fx 45 64b on Mint with e10s disabled (don't know why/when I disable it).
I also want to say, that I somehow installed two copies of script from github with URLs:
https://github.com/anonim1133/wykop-userjs/raw/master/wykop-zawijas.user.js
and with
https://raw.githubusercontent.com/anonim1133/wykop-userjs/master/wykop-zawijas.user.js
But I don't know how this happened and cannot reproduce.

@arantius
Copy link
Collaborator

arantius commented Feb 3, 2016

Back to the original issue (install URL when clicking show source).

With Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0, GM at e8d7643: NOT confirmed, both with e10s enabled and disabled.

And ugh, I meant to set up remote access to a Windows box today to be able to investigate that, but whoops, not accessible somehow.

@arantius arantius modified the milestones: 3.8, 3.7 Feb 3, 2016
@janekptacijarabaci
Copy link
Contributor

@arantius
Copy link
Collaborator

I've merged the semi-related notification bar fix above, and can no longer reproduce this. Closing for now, please reopen if you can still see this issue.

@arantius
Copy link
Collaborator

No sorry, have not merged, but still don't see this error.

@janekptacijarabaci
Copy link
Contributor

The bug is always the same. I thought I wrote everything above already (only on Windows, the discussion on bugzilla - e.g. STR, screenshot with proof of bug).

Now I don't know what is left to do...

@janekptacijarabaci
Copy link
Contributor

please reopen if you can still see this issue

I can not do it.

@janekptacijarabaci
Copy link
Contributor

Thanks for merged it.

@arantius arantius changed the title Source url is replaced by file:///tmp/* when installing from "Show sript source" [WINDOWS ONLY?] Source url is replaced by file:///tmp/* when installing from "Show sript source" Apr 18, 2016
@arantius
Copy link
Collaborator

I keep missing the maybe windows only part.

@arantius arantius reopened this Apr 18, 2016
@janekptacijarabaci
Copy link
Contributor

I personally don't know why it was reopened - it fixed the problem for me (8e19516).

I'm sorry, but I think it's a misunderstanding...

@arantius
Copy link
Collaborator

Because I wanted to confirm on windows, and now I have, and I agree.

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

3 participants