Calling window.close() should indicate failure with warning message

Calling window.close() has no effect on the main page as the calling script has not created the window.
In such case, a warning message should be added to the console stating the failure to honor window.close().

Firefox is showing the message "Scripts may not close windows that were not opened by script."
The same has been documented here https://developer.mozilla.org/en-US/docs/DOM/window.close

Also there is a bug in the DOMWindow::close() which closes the newly opened tab if window.close() is executed
from the console of inspector. This is incorrect as the scripts are not allowed to close the window which is not
created by it. Also if this is the only tab open, then the browser is also closed.

The existing condition checks whether the page is opened by DOM or the page has more than 1 backward/forward history 
items or the browser doesn't allow the script to close the window.
With a new tab opened and the window.close() being called from the inspector console, the second condition i.e. 
having only 1 item in backward/forward history evaluates to true. Its negated and hence the browser
honors the closing of window.

Instead, the if condition should first check whether the closing of window is allowed for the given script. Then it should 
check the rest of the conditions. This way closing of browser/tab is avoided.

BUG=170760

R=abarth, pfeldman, yurys

Review URL: https://codereview.chromium.org/22929032

git-svn-id: svn://svn.chromium.org/blink/trunk@160700 bbb929c8-8fbe-4397-9dbb-9b2b20218538