| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 void WebFrameImpl::setWebCoreFrame(WebCore::Frame* frame) | 2137 void WebFrameImpl::setWebCoreFrame(WebCore::Frame* frame) |
| 2138 { | 2138 { |
| 2139 ASSERT(frame); | 2139 ASSERT(frame); |
| 2140 observeFrame(frame); | 2140 observeFrame(frame); |
| 2141 } | 2141 } |
| 2142 | 2142 |
| 2143 void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page) | 2143 void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page) |
| 2144 { | 2144 { |
| 2145 m_frameInit->setPage(page); | 2145 // FIXME: This whole function can go away once ownerhip of WebFrame is rever
sed. |
| 2146 // Page should create it's main WebFrame, not have FrameLoader do it only |
| 2147 // to have to mark the frame as main later. |
| 2148 m_frameInit->setFrameHost(&page->frameHost()); |
| 2146 RefPtr<Frame> mainFrame = Frame::create(m_frameInit); | 2149 RefPtr<Frame> mainFrame = Frame::create(m_frameInit); |
| 2147 setWebCoreFrame(mainFrame.get()); | 2150 setWebCoreFrame(mainFrame.get()); |
| 2148 | 2151 |
| 2149 // Add reference on behalf of FrameLoader. See comments in | 2152 // Add reference on behalf of FrameLoader. See comments in |
| 2150 // WebFrameLoaderClient::frameLoaderDestroyed for more info. | 2153 // WebFrameLoaderClient::frameLoaderDestroyed for more info. |
| 2151 ref(); | 2154 ref(); |
| 2152 | 2155 |
| 2153 // We must call init() after m_frame is assigned because it is referenced | 2156 // We must call init() after m_frame is assigned because it is referenced |
| 2154 // during init(). | 2157 // during init(). |
| 2155 frame()->init(); | 2158 frame()->init(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2174 mustCallDidCreateFrame = true; | 2177 mustCallDidCreateFrame = true; |
| 2175 webframeLifetimeHack = adoptRef(WebFrameImpl::create(m_client)); | 2178 webframeLifetimeHack = adoptRef(WebFrameImpl::create(m_client)); |
| 2176 webframe = webframeLifetimeHack.get(); | 2179 webframe = webframeLifetimeHack.get(); |
| 2177 } | 2180 } |
| 2178 | 2181 |
| 2179 // Add an extra ref on behalf of the page/FrameLoader, which references the | 2182 // Add an extra ref on behalf of the page/FrameLoader, which references the |
| 2180 // WebFrame via the FrameLoaderClient interface. See the comment at the top | 2183 // WebFrame via the FrameLoaderClient interface. See the comment at the top |
| 2181 // of this file for more info. | 2184 // of this file for more info. |
| 2182 webframe->ref(); | 2185 webframe->ref(); |
| 2183 | 2186 |
| 2184 webframe->m_frameInit->setPage(frame()->page()); | 2187 webframe->m_frameInit->setFrameHost(frame()->host()); |
| 2185 webframe->m_frameInit->setOwnerElement(ownerElement); | 2188 webframe->m_frameInit->setOwnerElement(ownerElement); |
| 2186 RefPtr<Frame> childFrame = Frame::create(webframe->m_frameInit); | 2189 RefPtr<Frame> childFrame = Frame::create(webframe->m_frameInit); |
| 2187 webframe->setWebCoreFrame(childFrame.get()); | 2190 webframe->setWebCoreFrame(childFrame.get()); |
| 2188 | 2191 |
| 2189 childFrame->tree().setName(request.frameName()); | 2192 childFrame->tree().setName(request.frameName()); |
| 2190 | 2193 |
| 2191 frame()->tree().appendChild(childFrame); | 2194 frame()->tree().appendChild(childFrame); |
| 2192 | 2195 |
| 2193 // FIXME: Remove once all embedders return non-null from createChildFrame(). | 2196 // FIXME: Remove once all embedders return non-null from createChildFrame(). |
| 2194 if (mustCallDidCreateFrame) | 2197 if (mustCallDidCreateFrame) |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 ScriptValue result = frame()->script().executeScriptInMainWorldAndReturnValu
e(ScriptSourceCode(script)); | 2515 ScriptValue result = frame()->script().executeScriptInMainWorldAndReturnValu
e(ScriptSourceCode(script)); |
| 2513 | 2516 |
| 2514 String scriptResult; | 2517 String scriptResult; |
| 2515 if (!result.getString(scriptResult)) | 2518 if (!result.getString(scriptResult)) |
| 2516 return; | 2519 return; |
| 2517 | 2520 |
| 2518 if (!frame()->navigationScheduler().locationChangePending()) | 2521 if (!frame()->navigationScheduler().locationChangePending()) |
| 2519 frame()->document()->loader()->replaceDocument(scriptResult, ownerDocume
nt.get()); | 2522 frame()->document()->loader()->replaceDocument(scriptResult, ownerDocume
nt.get()); |
| 2520 } | 2523 } |
| 2521 | 2524 |
| 2522 void WebFrameImpl::willDetachPage() | 2525 void WebFrameImpl::willDetachFrameHost() |
| 2523 { | 2526 { |
| 2527 // FIXME: This should never be called if the Frame has already been detached
? |
| 2524 if (!frame() || !frame()->page()) | 2528 if (!frame() || !frame()->page()) |
| 2525 return; | 2529 return; |
| 2526 | 2530 |
| 2527 // Do not expect string scoping results from any frames that got detached | 2531 // Do not expect string scoping results from any frames that got detached |
| 2528 // in the middle of the operation. | 2532 // in the middle of the operation. |
| 2529 if (m_scopingInProgress) { | 2533 if (m_scopingInProgress) { |
| 2530 | 2534 |
| 2531 // There is a possibility that the frame being detached was the only | 2535 // There is a possibility that the frame being detached was the only |
| 2532 // pending one. We need to make sure final replies can be sent. | 2536 // pending one. We need to make sure final replies can be sent. |
| 2533 flushCurrentScopingEffort(m_findRequestIdentifier); | 2537 flushCurrentScopingEffort(m_findRequestIdentifier); |
| 2534 | 2538 |
| 2535 cancelPendingScopingEffort(); | 2539 cancelPendingScopingEffort(); |
| 2536 } | 2540 } |
| 2537 } | 2541 } |
| 2538 | 2542 |
| 2539 } // namespace blink | 2543 } // namespace blink |
| OLD | NEW |