Chrome extension occasionally crashing - why? - google-chrome-extension

I am developing an extension which uses the tab API, long-lived connections and HTML5 indexedDB. The extension crashes randomly (or at least I cannot reproduce a crash scenario). I took a look the the chrome log:
[22654:-1322192896:0118/184514:VERBOSE1:ipc_sync_channel.cc(382)] Canceling pending sends
[22649:-1398687192:0118/184514:VERBOSE1:speech_input_extension_manager.cc(228)] Extension unloaded. Requesting to enforce stop...
[22654:-1398687192:0118/184514:VERBOSE1:ipc_sync_channel.cc(382)] Canceling pending sends
[22654:-1322192896:0118/184514:VERBOSE1:ipc_sync_channel.cc(382)] Canceling pending sends
[22808:-1398687192:0118/184514:VERBOSE1:chrome_v8_context.cc(125)] Could not execute chrome hidden method: Port.dispatchOnDisconnect
[22808:-1398687192:0118/184514:VERBOSE1:chrome_v8_context.cc(125)] Could not execute chrome hidden method: Port.dispatchOnDisconnect
[22808:-1398687192:0118/184514:VERBOSE1:chrome_v8_context.cc(125)] Could not execute chrome hidden method: Port.dispatchOnDisconnect
[22808:-1398687192:0118/184514:VERBOSE1:chrome_v8_context.cc(125)] Could not execute chrome hidden method: Port.dispatchOnDisconnect
[22808:-1398687192:0118/184514:VERBOSE1:chrome_v8_context.cc(125)] Could not execute chrome hidden method: Port.dispatchOnDisconnect
[22808:-1398687192:0118/184514:VERBOSE1:chrome_v8_context.cc(125)] Could not execute chrome hidden method: Port.dispatchOnDisconnect
[22649:-1398687192:0118/184514:VERBOSE1:notification_ui_manager_impl.cc(83)] Added notification. URL: data:text/html;charset=utf-8,%3C!DOCTYPE%20html%3E%0A%3Chtml%3E%0A%3Chead%3E%0A%20%20%3Ctitle%3E%3C%2Ftitle%3E%0A%20%20%3Cstyle%3E%0A%20%20body%20%7B%0A%20%20%20%20direction%3A%20ltr%3B%0A%20%20%7D%0A%20%20%23icon%20%7B%0A%20%20%20%20height%3A%2032px%3B%0A%20%20%20%20width%3A%2032px%3B%0A%20%20%20%20float%3A%20left%3B%0A%20%20%7D%0A%20%20%23title%20%7B%0A%20%20%20%20margin-left%3A%2038px%3B%0A%20%20%20%20font-weight%3A%20bold%3B%0A%20%20%20%20font-size%3A%2013px%3B%0A%20%20%20%20font-family%3A%20helvetica%2C%20arial%2C%20sans-serif%3B%0A%20%20%7D%0A%20%20%23description%20%7B%0A%20%20%20%20margin-left%3A%2038px%3B%0A%20%20%20%20font-family%3A%20helvetica%2C%20arial%2C%20sans-serif%3B%0A%20%20%20%20font-size%3A%2013px%3B%0A%20%20%7D%0A%20%20%3C%2Fstyle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%20%20%3Cdiv%20id%3D%22icon%22%3E%3Cimg%20src%3D%22chrome-extension%3A%2F%2Fegoecnhkgdfeofmdmjgopmdjbaknldjf%2Fres%2Ficon_48x48.png%22%20width%3D%2232%22%20height%3D%2232%22%3E%3C%2Fdiv%3E%0A%20%20%3Cdiv%20id%3D%22title%22%3E%3C%2Fdiv%3E%0A%20%20%3Cdiv%20id%3D%22description%22%3EHelloWorld%20ist%20abgest%C3%BCrzt.%20Klicken%20Sie%20auf%20dieses%20Fenster%2C%20um%20die%20Erweiterung%20erneut%20zu%20laden.%3C%2Fdiv%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A
I activated the most chatty verbose mode but it doesn't make sense to me what causes the crash. Any suggestions?

You should submit a ticket to the Chromium Project http://code.google.com/p/chromium/issues/list and someone from Google will respond back to you in couple days.

I had a similar problem it took me a full day to solve, I think it may apply. My popup extension would run without crashing if I simply opened it, however if I opened the extension in developer mode (ie right click -> 'Inspect Popup') the next time I'd try to open it would crash.
This appears to be a problem with Chrome's new Device Mode feature. To fix this, I had to open my popup.html file in a new tab, and make sure Device Mode was OFF. Then, when I opened my extension in developer mode, it would not crash anymore.
To turn off Device Mode:
Open your html file in a new tab
Enter developer mode (View -> Developer -> Javascript Console)
Ensure that device mode is off (Device mode is toggled by clicking the small image of a mobile phone that is beside the magnifying glass)
Hope this helps one of you.

Related

What is the best practice for updating open tabs after your Chrome Extension updates (with content script)?

My Extension's content script interacts with every open tab.
When I update my Extension any existing tabs will have the old content script and my Extension will not function.
I have tried putting an alert on the page asking users to refresh (triggered by catching an error), which is confusing to users. This answer (chrome extension API for refreshing the page) shows how to refresh all open tabs...and if placed in background.js in the onInstalled listener (reason === "update") we can force all open tabs to refresh. But this feels invasive and alarming to the user.
What is the best practice?

Robot framework: How to Log out from web application and close chrome browser using selenium webdriver?

My Robot framework Execution hangs after clicking on log out.
Here is my sample Code:
Wait Until Page Contains Element //a[contains(text(),'Log Out')]
Click Link //a[contains(text(),'Log Out')]
Close Browser
Open Webpage ${browser} ${user} &{Login}[${user}] ${Url_Link}
Maximize Browser Window
This Code works on Firefox, But with Google Chrome the execution is Hanging at the Below step.
Click Link //a[contains(text(),'Log Out')]
Clicking on the Logout is successful, But the execution Hangs in the same step and it doesn't go the next step. However this works fine with Firefox.
Request to help me with any suggestions.

How to detect when another Chrome Extension overrides the same page

An example would be if my extension overrides the newtab page and the user installs another extension that also overrides the newtab page. Currently, only one newtab extension shows up and it usually isn't mine.
What can I do to detect when such a conflict occurs and inform the user of such?
The management API doesn't tell me if the extensions override any pages, so I sadly can't use that.
This doesn't seem to be an exant feature of the API. I'd suggest you open a bug at http://crbug.com.
Failing that, you can perform the following nasty hack (which I haven't tested):
Have your new tab page send a message to your background page whenever it loads.
Listen for chrome.webNavigation.onBeforeNavigate events that deal with chrome://newtab:
chrome.webNavigation.onBeforeNavigate.addListener(function(details) {
/* send message */
}, { url: [{ urlEquals: 'chrome://newtab/' }] });
When webNavigation sees the browser load chrome://newtab but you don't see a message to your background page shortly afterwards, your new tab page is probably not being used. From there, you can send a notification, or open another tab/window with a notice.
Unfortunately, this requires the webNavigation permission, which is unfortunate if your extension doesn't otherwise need it. The warning that it carries ("This extension can access your tabs and browsing activity") might scare away some potential users, especially if there's no reason for it that is obvious to the user. (Then again, perhaps I'm being too optimistic about the security-conscientiousness of users.) If your extension currently uses the tabs API, then it already carries this notice anyway.

Specific Event for Opening Chrome

I am trying to replicate FireFox preference of delaying tab loading "Options > General > "Don't load tabs until selected" as an extension in Chrome.
Basically, I was trying to use WebRequest (http://code.google.com/chrome/extensions/webRequest.html) but I am running into two issues:
1) I need to hook into an event to block all requests for open tabs initially. Currently, it seems that only select tabs are blocked while others load when Chrome.app opens.
2) Unregister my webRequest onBeforeRequest event after the initial blocking of tabs. This is only the behavior I need when the initial app load happens.
I already understand how to reload tabs on focus.

browser related question

I get different behavior between IE and Mozilla.
Say for ex I have 2 buttons on my webpage. Button-1 and Button-2
In mozilla browser, when I click Button-1 then it process the click request of Button-1, while it is processing the request, immediately if I Click on button-2, browser will not proceed request for Button-2.
In IE browser, after clicking Button-1 If I immediately click Button-2 then it will first process request of Button-1 and then it will process request for Button-2.
Why there is different behavior for both browser for same web page?
PS. IE 8 and Mozilla 3
Thats's life
Browser differences are one of the biggest hurdles in modern web development. You're best bet is to paste the code to let users take a look.

Resources