Validate debuggee.targetId before use in chrome.debugger

And refactored the tests to make sure that the debugger is detached upon
returning from RunAttachFunction. Previously, if the debugger
unexpectedly succeeded in attaching, the method would return (because
empty error != some error), causing the attached debugger to not be
TEST=browser_tests DebuggerApiTest.DebuggerNotAllowedOnOtherExtensionPages

Review URL:

Cr-Commit-Position: refs/heads/master@{#315675}
2 files changed