On JULY 16, 2014 WEDNESDAY, Chrome release its version 36.0.1985.125 which fixed some security related issues. Here is the Release note.

According to the releas note, the new version contains a number of fixes and improvements, including:

Rich Notifications Improvements
An Updated Incognito / Guest NTP design
The addition of a Browser crash recovery bubble
Chrome App Launcher for Linux
Lots of under the hood changes for stability and performance


It also said:

This update includes 26 security fixes. Below, we highlight fixes that were either contributed by external researchers or particularly interesting. Please see the Chromium security page for more information.

From my observation, this update fixed the issue on using window.close() to close the popup window. You will see this in the console when it fail, “Scripts may close only the windows that were opened by it.”

So, in the previous Chrome released builds, the below code block may worked but not with this update.

1
2
window.open('', '_self', '');
window.close();

Above is to open a new window with about:blank to replace the current page, then close it. From this Chrome update, you have to update your code accordingly to close the popup window. One of the solution is to grab the popup window id and use

1
chrome.windows.remove(integer windowId, function callback)

method to remove it. Chrome extension windows API can be found at chrome.windows.

chrome.windows.remove is Chrome extension API, javascript program should be recognized by chrome extension. You can try by putting it inside background.js, in your chrome extension manifest.json you need to have:

1
2
3
4
"background": {
"scripts": ["background.js"],
...
},

In the past, a great discussion around this window close issue can be found at stackoverflow.

Actually my chrome extension MarkView was facing this issue and I had to update my code to make it work for this Chrome Update. By the way, MarkView is tool to read and write Awesome Markdown Files, it provides features including Content Outline, Sortable Tables and code block syntax highlight with line number.

Update: Due to the design changes, MarkView no longer use popup window
for login, user won’t see the action of “close popup window” in current version of MarkView.