1

I tried to write a bookmarklet which depends on another script. For this my bookmarklet includes a function like this:

function load(url, callback) {
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = url;
    script.async = false;
    script.onload = callback;
    document.head.appendChild(script);
}

The callback function is called on most pages, but on some pages I get the following exception in the console and the script is not loaded (facebook.com is one example).

Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE)

An example of a bookmarklet:

javascript:function%20load(url,callback){var%20script=document.createElement('script');script.type='text/javascript';script.src=url;script.onload=callback;document.head.appendChild(script);}load('http://code.jquery.com/jquery-1.11.1.min.js',function(){console.log('Loaded');})

I use FireFox 29 on Ubuntu 12.04. If it is executed a "Loaded" should a appear in the console. On the first load an additional access to the resource is visible in the console. But as written above on e.g. facebook.com nothing happens at all. Neither is the script loaded nor is the callback called.

3
  • 1
    "Some pages"? Which pages? If we were going to reproduce this issue, what would we have to do? Commented May 21, 2014 at 15:47
  • Where it happens was written in my question before. I've added a boorkmarklet with the the same code below. Commented May 21, 2014 at 15:56
  • So how do we reproduce this issue? Write out the steps for us so that we can reproduce it. As it's written, you've given us a script, and said, "This doesn't work" -- that doesn't help us. We need to be able to go through the steps you're going through. So what are those steps? (Please edit this into your question). Commented May 21, 2014 at 15:57

1 Answer 1

1

It was quite likely due to XSS from the bookmarklet itself. FF 35.0 doesn't have an error anymore and shows a well formatted message.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.