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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:18:00+00:00 2026-06-04T12:18:00+00:00

In my background script: var collection = Backbone.Collection.extend({}); chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { sendResponse(new collection());

  • 0

In my background script:

var collection = Backbone.Collection.extend({});

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
  sendResponse(new collection());
}

In my browser_action’s javascript:

chrome.tabs.getSelected(null, function(tab) {
  chrome.extension.sendRequest({
    action: "someAction",
    tab: tab 
  },  
  function(collection) {
    // collection is now a JS array, rather than Backbone.Collection
  }); 
}); 

As mentioned in the comment above the ‘collection’ argument in the sendRequest callback turns out to be a regular JS array, rather than Backbone.Collection.

Is this a sanitisation artefact / security measure taken by chromium? Is there any way to pass a Backbone.Collection via sendRequest?

  • 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-04T12:18:01+00:00Added an answer on June 4, 2026 at 12:18 pm

    From the onRequest documentation it says that the argument to sendResponse should be a JSON-ifiable object, so I’m assuming that the Collection’s toJSON method is being called, leaving you with just the data.

    If you have the Collection definition in the target script you could instantiate a new object with the same data.

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

Sidebar

Related Questions

so i have this script: <script type=text/javascript> $(window).load(function () { var imagePath = new
<style> #test{ background-color:#b10515; width=440px; } </style> <script> ... ... cell[k]=document.createElement('td'); var cont = document.createElement('a');
<html> <body> <script language=javascript> function getSelectionHTML() { var div = document.getElementById(myDiv); if (document.createRange) {
I have the following backbone.js client side template: <script id=calleeTemplate type=text/x-jquery-tmpl> <tr style=background-color: ${StatusColour}>
I want to trigger the click, to which following code is listening: chrome.browserAction.onClicked.addListener(function(tab) {});
I have this jquery script: $('[id^=changesetList] tr').each(function () { var sid = $(this).attr('sid'); $(this).find('td
$(.Go_Image).live('click', function(event) { var imageurl = $(#ImageUrl).attr('value'); $('#Image').css({'background-image', 'url(' + imageurl + ')'}); });
<script language=JavaScript type=text/javascript> var theBar = createProgressBar(document.getElementById('progress-bar')); var value; function resetValue() { value =
<script src=http://widgets.twimg.com/j/2/widget.js></script> <script> var usr = 'charliesheen'; function changeusr() { usr = document.getElementById(usrText).value; updatetwitter();
Take a look at this snippet below: <script> $(function(){ var to_username = alex; window.Persona

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.