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 8587055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:28:22+00:00 2026-06-11T22:28:22+00:00

I am learning to develop a Browser Action extension for Google Chrome, and have

  • 0

I am learning to develop a Browser Action extension for Google Chrome, and have split up javascript functionality into multiple files. In the popup.html file, script resources are defined like

<script src="js/Identity.js"></script>
<script src="js/View.js"></script>

View.js needs to call into methods of the object exposed from Identity.js, and passes a callback function to be notified when the process is completed. However, it appears Chrome would break execution.

Refused to evaluate script because it violates the following Content
Security Policy directive: “script-src ‘self'”

From what i understand, Google states that policy is to prevent arbitrary strings to be evaluated into an executable block of logic. However I am passing actual functions between my objects so i’m not too sure what must be corrected here?

IdentityObj.Process = function (params, callback) {
  doSomeWork();
  setTimeout(callback(true), 1000); // break here
};

From the View object, an example would be

View.loginClick = function(event) {
        event.preventDefault();
        this.loggingInState();

        var emailAddr = $('#emailAddr').val();
        var password = $('#password').val();
        IdentityObj.login(emailAddr, password, this.loginCallback.bind(this));
    };

View.loginCallback = function(success) {
        if (success) { this.usageState(); }
        else { this.errorState(); }
    };
  • 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-06-11T22:28:23+00:00Added an answer on June 11, 2026 at 10:28 pm

    My colleague sported the problem and explained it, so now I understand what you were referring to.

    I was executing the callback function direct in the setTimeout() definition, so setTimeout() receives the result of callback(true) instead of the callback itself. That would then require an eval and thus triggering the Chrome security policy.

    The execution of callback() has to be wrapped in a function declaration.

    IdentityObj.Process = function (params, callback) {
      doSomeWork();
      setTimeout(function(){callback(true)}, 1000); // break here
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am interested in learning to develop browser extensions for most major browsers (Chrome,
I am learning how to develop iPhone applications and I ran into an interesting
I develop websites since last two years now and I have hard time learning
Today I started learning how to develop for Windows Phone, and I have a
I'm learning to develop apps using Qt Creator. I have built a simple app
I have been learning to develop websites using ASP.NET MVC 2 for work... and
I have started to develop E-Learning application and want to know Are There any
I'm currently learning how to develop with Go (or golang) and I have a
I have recently just started learning how to develop android applications. I am am
I am a rookie learning to develop web sites. To this point I have

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.