Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7003167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:01:47+00:00 2026-05-27T21:01:47+00:00

I have written a userscript , and run it in Greasemonkey 0.9.13. If I

  • 0

I have written a userscript, and run it in Greasemonkey 0.9.13.

If I remove the only try... catch block (line 54-66) but keep the code inside it, it will throw exceptions like below:

uncaught exception: [Exception… “Operation is not supported” code:
“9” nsresult: “0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)” location:
“resource://greasemonkey/runScript.js Line: 29”]

However, stripped scripts run well in Chrome w/o any problems.

However, it will NOT print anything into console, which means codes in try block don’t throw exception if wrapped by try block.

Can you guys tell me why it works?

This is the code snippet from that linked source:

var streamItems = $('div.main-content div.stream-item');
var streamItemsLength = streamItems.length;
var innerHeight = window.innerHeight;
var scrollY = window.scrollY;
var y = scrollY + innerHeight;
var tweet;
var tweetHeight = 0;
try {
  for (var sumHeight = getHeaderHeight(), num = 0; sumHeight < y; num++, sumHeight += tweetHeight) {
    tweet = streamItems[num];
    tweetHeight = getHeight(tweet);
    if (tweetHeight == 0) {
      removeClass(tweet, 'hidden-tweet');
      tweetHeight = getHeight(tweet);
    }
  }
}
catch (e) {
  console.log(e.stack);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:01:48+00:00Added an answer on May 27, 2026 at 9:01 pm

    That script needs the try block (as you can see) because the logic of the for loop is very poor (it will often overrun the streamItems array and probably has a race condition when removing the hidden-tweet class).

    You say it doesn’t throw exceptions in Chrome, but it looks like this is just happenstance. With the right conditions, it should fail in Chrome too — or maybe Chrome’s node manipulation is just enough different. It doesn’t matter, the code is poor.

    As for it not printing anything to the console, are you sure? It does in my tests.

    But sometimes between anonymous function wrappers and event listeners, maybe the error stack might appear to be empty.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have written a method; when I try to run it, I get the error:
I have written following code for the client of RMI. But getting java.rmi.ConnectException: Connection
I have written some code in my VB.NET application to send an HTML e-mail
I have written a site in Prototype but want to switch to jQuery. Any
I have written a Userscript for Facebook and it groups similar notifications together. Now,
Have written the following code: m_selectCategoryTableWidget = new QTableWidget; m_selectCategoryTableWidget->setRowCount(0); m_selectCategoryTableWidget->setColumnCount(2); m_selectCategoryTableWidget->setHorizontalHeaderLabels(QStringList()<<tr(Category)<<tr(Number of items));
I have written this code that loops through an array of lat/long coordinates and
I have written this piece of code that splits a string and stores it
Have written some RoR sites in the past, but never bothered too much at
I have written a generic class class MyClass : MyClass<string> { } //this line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.