Results 1 to 3 of 3

This is a discussion on Size limit for content script? within the Plugins Development section, part of the Chrome Plugins category: Hi there. This is the general structure of my extension: A background_page called background.html No popup Permissions [ "tabs", "http://*/*" ...


  1. #1
    devnull69 is offline Member
    Join Date
    Jul 2010
    Posts
    32

    Default Size limit for content script?

    Hi there.

    This is the general structure of my extension:
    1. A background_page called background.html
    2. No popup
    3. Permissions [ "tabs", "http://*/*" ]
    4. The background page uses chrome.tabs.executeScript to inject the content script into the page (from inside a browserAction.onClicked listener)
    5. It has an onRequest listener. The request is fired from the content script. The listener sends a response to the content script in the end. The content script then uses this response to change the respective page

    Now my problem:
    The content script has grown bigger and bigger over time and now I seem to have reached some limit ... even if I just add comment lines, it will not execute any more. There is no error (as far as I can see), but it just won't execute any more.

    Is there a size limit for content scripts injected using executeScript?

  2. #2
    Waha's Avatar
    Waha is offline Senior Member
    Join Date
    Apr 2009
    Location
    Oregon
    Posts
    788

    Default

    I haven't heard of one. Have you tried splitting up you content script into multiple files and injecting them?
    Also, why not just use the content_scripts section in the manifest to inject them, and send a message to the background page from the base level of the script? If you need the tab info, that's sent with the message when it's a content script.
    ~ Projects ~
    Specialized: Carapass Auction Watcher, Kongregate Chat
    Libraries: bliplib
    Tools: manifest syntax highlighting & snippits
    ~ Happy to make extensions for pay too ;D ~
    Portfolio: Search and Share

  3. #3
    devnull69 is offline Member
    Join Date
    Jul 2010
    Posts
    32

    Default

    I use the content_scripts section of the manifest now. But no luck on my first try.

    Then I removed line by line and identified the problem: One line of the code had a special character inside a comment(!) and Chrome stopped working without complaining. I think I will have to switch to UTF-8 even if I use special chars only in comments ...

Similar Threads

  1. How to debug content script?
    By alex82 in forum Plugins Development
    Replies: 5
    Last Post: 09-02-2010, 01:45 PM
  2. content script help
    By crackruckles in forum Plugins Development
    Replies: 7
    Last Post: 02-19-2010, 04:31 AM
  3. Content Script Issues
    By hexid in forum Plugins Development
    Replies: 2
    Last Post: 12-15-2009, 03:37 PM
  4. Stuck with content script...
    By rohit in forum Plugins Development
    Replies: 1
    Last Post: 12-15-2009, 03:19 PM
  5. content script problem..
    By Gaurang033 in forum Chrome Plugins
    Replies: 0
    Last Post: 06-01-2009, 11:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •