extensions: Use on-demand cache for ScriptContext::GetURL().

Caching the URL in ScriptContext is necessary since it can be called after the
page has been closed. This fixes detaching event-bindings during tear-down.

BUG=434727
[email protected], [email protected]

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

Cr-Commit-Position: refs/heads/master@{#306658}
diff --git a/extensions/renderer/script_context.h b/extensions/renderer/script_context.h
index 8d6f853..af7fb1f6 100644
--- a/extensions/renderer/script_context.h
+++ b/extensions/renderer/script_context.h
@@ -15,6 +15,7 @@
 #include "extensions/renderer/safe_builtins.h"
 #include "extensions/renderer/scoped_persistent.h"
 #include "gin/runner.h"
+#include "url/gurl.h"
 #include "v8/include/v8.h"
 
 namespace blink {
@@ -181,6 +182,8 @@
 
   v8::Isolate* isolate_;
 
+  GURL url_;
+
   DISALLOW_COPY_AND_ASSIGN(ScriptContext);
 };