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

  • SEARCH
  • Home
  • 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 6786245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:13:20+00:00 2026-05-26T17:13:20+00:00

I currently have quite the predicament. An if statement I have written – which

  • 0

I currently have quite the predicament. An if statement I have written – which evaluates to true – is not being executed. The execution continues to the else. I’ll include a piece of the code in hopes that it will aid in determining what’s going on.

I’m building a google chrome extension, and my popup.html is making a request to my content script, which is returning some values. After this I use the variables obtained to perform the if statement logic.

var timer;    
var status;                
chrome.tabs.getSelected(null, function(tab)
{
    chrome.tabs.sendRequest(tab.id, {method : 'GetTimer'}, 
    function(response)
    {
        timer = response.Timer;
    });

    chrome.tabs.sendRequest(tab.id, {method : 'GetStatus'}, 
    function(response)
    {
        status = response.Status;
    });
});

// here is where the issue is occuring
if (status && status === bg.StopText)
{
}

When I breakpoint on the if statement itself, I can see that status is equal to “Stop”, and bg.StopText is also equal to “Stop”. Furthermore, when I copy

status && status === bg.StopText

into my console and execute it, the result is true.

Can anyone see if there is an issue I’m glossing over, and possibly some steps I could take to troubleshoot this further?

  • 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-26T17:13:21+00:00Added an answer on May 26, 2026 at 5:13 pm

    You have a race condition. If you send request, you can’t check status until the request returns, it’s asynchronous. When you pause execution, it allows time for the async call to complete and looks like you have a value already.

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

Sidebar

Related Questions

I currently have quite a messy query, which joins data from multiple tables involving
I currently have a method which is quite simple and calculates a list of
I'm currently using QDataStream to serialize my classes. I have quite a few number
I currently have 4 textboxes which will be used to store an ip address.
We currently have quite a few classes in a project, and each of those
I currently have some objective C code which I use to identify the difference
I have a quick question regarding memory management that I am not quite sure
I currently have an SQL query which is currently called multiple times like this
I've have quite small asp.net MVC 2 application to maintain/extend. Currently it uses hand
I currently have database setup like so: CREATE TABLE `article` ( `id` int(11) NOT

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.