Reviewed by Sam.

        - fixed <rdar://problem/5220706> REGRESSION (TOT): repro crash in -[WebView(WebViewInternal) _addObject:forIdentifier:] [14425]
        http://bugs.webkit.org/show_bug.cgi?id=14425

        * bindings/js/kjs_window.cpp:
        (KJS::createWindow): No longer take an immediate argument - always do immediate loads
        on a newly created Window. Also, do a load of "" to make sure that the right info makes
        it to the app.
        (KJS::showModalDialog): Updated for above.
        (KJS::WindowFunc::callAsFunction): Updated for above.
        * dom/Document.cpp:
        (WebCore::Document::shouldBeAllowedToLoadLocalResources): If our URL is about:blank,
        we're allowed if our opener is (since the opener must have written the contents).
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::changeLocation): Add a variant which takes a KURL, which it
        expects to be pre-completed. This is to avoid completing "" to the opener URL.
        (WebCore::FrameLoader::urlSelected): Allow loading empty URLs.
        * loader/FrameLoader.h:
        
        Test case is manual only, since it takes particular app behavior to reproduce:
        
        * manual-tests/new-window-subresource-crash.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@24105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index dcae6bd..24cb09c 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -346,8 +346,13 @@
 
 void FrameLoader::changeLocation(const String& URL, const String& referrer, bool lockHistory, bool userGesture)
 {
-    if (URL.find("javascript:", 0, false) == 0) {
-        String script = KURL::decode_string(URL.substring(strlen("javascript:")).deprecatedString());
+    changeLocation(completeURL(URL), referrer, lockHistory, userGesture);
+}
+
+void FrameLoader::changeLocation(const KURL& URL, const String& referrer, bool lockHistory, bool userGesture)
+{
+    if (URL.url().find("javascript:", 0, false) == 0) {
+        String script = KURL::decode_string(URL.url().mid(strlen("javascript:")));
         JSValue* result = executeScript(0, script, userGesture);
         String scriptResult;
         if (getString(result, scriptResult)) {
@@ -360,7 +365,7 @@
 
     ResourceRequestCachePolicy policy = (m_cachePolicy == CachePolicyReload) || (m_cachePolicy == CachePolicyRefresh)
         ? ReloadIgnoringCacheData : UseProtocolCachePolicy;
-    ResourceRequest request(completeURL(URL), referrer, policy);
+    ResourceRequest request(URL, referrer, policy);
     
     urlSelected(request, "_self", 0, lockHistory, userGesture);
 }
@@ -377,7 +382,7 @@
         return;
     }
 
-    if (!url.isValid())
+    if (!url.isValid() && !url.isEmpty())
         return;
 
     FrameLoadRequest frameRequest(request, target);