How does this create an error? - javascript

I have a jquery/ajax website at tarh33ls.com
For some reason, in firefox, i get the following error:
uncaught exception: [Exception...
"Component returned failure code:
0x80004005 (NS_ERROR_FAILURE)
[nsIDOMLocation.href]" nsresult:
"0x80004005 (NS_ERROR_FAILURE)"
location: "JS frame ::
http://tarh33ls.com/ :: ::
line 26" data: no]
Line 0
but line 26 is:
if (location.href.indexOf("#")==-1) {location.href="http://tarh33ls.com/#";}
How would that generate an error?

I'm not sure why the error happens, but it seems this fixes it:
Move the if (location.href.indexOf("#") == -1 code inside the $(document).ready block (at the top of it), like this:
$(document).ready(function() {
if (location.href.indexOf("#") == -1) {
location.href="http://tarh33ls.com/#";
}
$.ajaxSetup({
...etc

Related

Firefox history.pushState error

history.pushState(null, null, '?state=1');
When trying the above in firefox console, it returns the below error:
[19:15:18.029] history.pushState(null, null, '?state=1');
[19:15:18.032] [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHistory.pushState]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: Web Console :: <TOP_LEVEL> :: line 1" data: no]
I am not sure why... Also, my webpage which uses History.js returns the same error too. Everything works fine in Chrome.
Firefox 12.0
Any help would be greatly appreciated...

does this error affect my code.?

i m getting error in firebug console
uncaught exception: [Exception... "'Invalid save data.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: chrome://firebug/content/spy.js :: callPageHandler :: line 744" data: no]
When i put this code
value = key+'^_^'+value;
But when i modify this code and put
value = key
the error removes.
so does this error affect my code?
I have an inkling that this might be a good place for exceptions. Exceptions allow you catch errors, which in Javascript is very handy indeed because it also allows you to execute altetrnative code if your browser doesn't support what you are trying to do.
try {
somethingThatOnlyWorksInChrome();
}
catch (ex) {
worksInEverythingElse();
}

elRTE error 0x80004005 in Firefox

Error: uncaught exception: [Exception...
"Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]"
nsresult: "0x80004005
(NS_ERROR_FAILURE)"
location: "JS frame :: http://localhost/mypage/admin/elrte/js/elrte.min.js
:: <TOP_LEVEL> :: line 34" data: no]
Why am I getting this error in Firefox, with the elRTE plugin? I didn't try it in other version of Firefox. But in Firefox 5 I'm getting this error?
display:none in style parent div occurs this problem, I explain what I want to say in here,
http://elrte.org/redmine/boards/4/topics/3279

js method fails (throws exception?), which firebug does not report

The following js method does not return, yet firebug reports no exception:
function test_contains_doesNotBailWithoutException() {
$.contains(document.getElementById('navlinks', undefined));
// This line should be reached, or you should get an exception message in Firebug.
return true;
}
where navlinks is something that exists on the page, and $ is from jquery 1.5.1. The method exits (throws, I assume) while calling the contains method, in line 4639 of jquery1.5.1:
return !!(a.compareDocumentPosition(b) & 16);
where a is the navlinks div and b is undefined. Shouldn't firebug report an exception in the console?
To be sure, running the following in the firebug console yields neither an error message nor a return result:
return document.getElementById('navlinks').compareDocumentPosition(undefined);
EDIT: I'm using Firefox 4.0.1 and Firebug 1.7.1.
Yes, there should be an exception; I certainly get one with either the JavaScript version:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOM3Node.compareDocumentPosition]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: javascript:alert(document.body.compareDocumentPosition(undefined)) :: <TOP_LEVEL> :: line 1" data: no]
or the same thing from the jQuery version (which has a bracket in the wrong place in your example... not that it matters since the missing argument will naturally get filled in with undefined anyway):
Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOM3Node.compareDocumentPosition]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js :: <TOP_LEVEL> :: line 16" data: no]

error in firefox with markitup

I get the following error when I use MarkItUp Editor,
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /jquery.markitup.js :: get :: line 418" data: no]
the line is
caretPosition = textarea.selectionStart;
I searched the internet but found nothing that helps me. The problem is in firefox 3.6 and 4.1.

Categories