rlr / dotjs-addon

[unmaintained] ~/.js for Firefox
BSD 3-Clause "New" or "Revised" License
144 stars 17 forks source link

Specific js code not loaded #23

Closed NumEricR closed 11 years ago

NumEricR commented 11 years ago

Hi

Since several months my specfic JS files aren't loaded. I don't understand why and I've tried a bunch of things but I can't fix that. I use the last version downloaded from its official page with Firefox 17.0.1.

I tried a simple code to replace all the content of the current page : $('body').html('test'); In the default.js it works fine but it fails if I put it in google.com.js for example :-/

There is no problems with my CSS files.

Does somebody have the same problem or understand what append ?

rlr commented 11 years ago

This works fine for me on 17.0.1 (on OS-X 10.8.2):

$ more ~/.js/google.com.js 
alert('hi');
rlr commented 11 years ago

Any change you are being redirected to a country specific google domain?

NumEricR commented 11 years ago

I've tried with xkcd.com, youtube.com, delicious.com, ... I get this issue even if I disable all of my addons exept this one.

FF 17.0.1 on OSX 10.6.8

kewball commented 11 years ago

I'm not at all good with the Javascript. I'm reading this bug report because it seems to me that other scripts on a page - advertising, for example - if these other scripts are broken (show errors in firebug console) then my dotjs never runs. Even when testing as described above alert('hi');

nashby commented 11 years ago

@kewball yeah, looks so. @rlr any idea why it's happening?

rlr commented 11 years ago

@nashby Do you have a default.js file? If so, it is fixed but waiting review on addons.mozilla.org. See issue #28 I think this is a dupe of that. Closing this one.

nashby commented 11 years ago

@rlr no, I don't have default.js. As @kewball said if site has js errors looks like dot.js can't load user's scripts. I think you can reproduce it with github.com. Just add github.com.js with alert('1'); and it won't work since there is an error CSP ERROR: Couldn't parse invalid source 'unsafe-inline'

rlr commented 11 years ago

Oh, it's a CSP issue. Hmm nice.

nashby commented 11 years ago

I think it doesn't matter what kind of error is present on the page, dot.js won't work anyway.

NumEricR commented 11 years ago

I've looked at my .js folder and I have an empty "default.js". When I remove this useless file, my scripts works ! Really happy :D

Firefox 20.0 and dotjs 1.9

NumEricR commented 11 years ago

I've got the release "1.10" and now everything is ok! :smile:

If I create an empty default file (css or js), my custom code on specific files are still used. And if I add some test code on default.css I can see its results too.

Therefore I close this issue. Thanks @rlr.

djmaze commented 10 years ago

So, the CSP issue reported by @nashby is still unsolved. My custom js or css are not loaded for github.com. Getting the following errors in the web developer console:

Content Security Policy: The page's settings blocked the loading of a resource: An attempt to call JavaScript from a string (by calling a function like eval) has been blocked (dotjs.js.:7)

and:

Content Security Policy: The page's settings blocked the loading of a ressource: An attempt to execute inline scripts has been blocked (:23)

Seems like Github is sending CSP headers which are blocking dotjs. There will be more and more sites doing this in the future, I suppose. Is there any way around this in Firefox addons?