| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
rome(), didAllowNavigation)) | 1256 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
rome(), didAllowNavigation)) |
| 1257 break; | 1257 break; |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 if (i == targetFrames.size()) | 1260 if (i == targetFrames.size()) |
| 1261 shouldClose = true; | 1261 shouldClose = true; |
| 1262 } | 1262 } |
| 1263 return shouldClose; | 1263 return shouldClose; |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 bool FrameLoader::validateTransitionNavigationMode() |
| 1267 { |
| 1268 if (frame()->document()->inQuirksMode()) { |
| 1269 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessageLeve
l, "Ignoring transition elements due to quirks mode."); |
| 1270 return false; |
| 1271 } |
| 1272 |
| 1273 // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/sc
aling issues. |
| 1274 return true; |
| 1275 } |
| 1276 |
| 1277 bool FrameLoader::dispatchNavigationTransitionData() |
| 1278 { |
| 1279 Vector<Document::TransitionElementData> elementData; |
| 1280 frame()->document()->getTransitionElementData(elementData); |
| 1281 if (elementData.isEmpty() || !validateTransitionNavigationMode()) |
| 1282 return false; |
| 1283 |
| 1284 Vector<Document::TransitionElementData>::iterator iter = elementData.begin()
; |
| 1285 for (; iter != elementData.end(); ++iter) |
| 1286 client()->dispatchAddNavigationTransitionData(iter->scope, iter->selecto
r, iter->markup); |
| 1287 |
| 1288 return true; |
| 1289 } |
| 1290 |
| 1266 void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame
LoadType type, PassRefPtrWillBeRawPtr<FormState> formState, const SubstituteData
& substituteData, ContentSecurityPolicyCheck shouldCheckMainWorldContentSecurity
Policy, ClientRedirectPolicy clientRedirect, const AtomicString& overrideEncodin
g) | 1291 void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame
LoadType type, PassRefPtrWillBeRawPtr<FormState> formState, const SubstituteData
& substituteData, ContentSecurityPolicyCheck shouldCheckMainWorldContentSecurity
Policy, ClientRedirectPolicy clientRedirect, const AtomicString& overrideEncodin
g) |
| 1267 { | 1292 { |
| 1268 ASSERT(client()->hasWebView()); | 1293 ASSERT(client()->hasWebView()); |
| 1269 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) | 1294 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) |
| 1270 return; | 1295 return; |
| 1271 | 1296 |
| 1272 const ResourceRequest& request = action.resourceRequest(); | 1297 const ResourceRequest& request = action.resourceRequest(); |
| 1273 | 1298 |
| 1274 // The current load should replace the history item if it is the first real | 1299 // The current load should replace the history item if it is the first real |
| 1275 // load of the frame. | 1300 // load of the frame. |
| 1276 bool replacesCurrentHistoryItem = false; | 1301 bool replacesCurrentHistoryItem = false; |
| 1277 if (type == FrameLoadTypeRedirectWithLockedBackForwardList | 1302 if (type == FrameLoadTypeRedirectWithLockedBackForwardList |
| 1278 || !m_stateMachine.committedFirstRealDocumentLoad()) { | 1303 || !m_stateMachine.committedFirstRealDocumentLoad()) { |
| 1279 replacesCurrentHistoryItem = true; | 1304 replacesCurrentHistoryItem = true; |
| 1280 } | 1305 } |
| 1281 | 1306 |
| 1282 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, su
bstituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.ur
l())); | 1307 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, su
bstituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.ur
l())); |
| 1283 m_policyDocumentLoader->setTriggeringAction(action); | 1308 m_policyDocumentLoader->setTriggeringAction(action); |
| 1284 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory
Item); | 1309 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory
Item); |
| 1285 m_policyDocumentLoader->setIsClientRedirect(clientRedirect == ClientRedirect
); | 1310 m_policyDocumentLoader->setIsClientRedirect(clientRedirect == ClientRedirect
); |
| 1286 | 1311 |
| 1287 Frame* parent = m_frame->tree().parent(); | 1312 Frame* parent = m_frame->tree().parent(); |
| 1288 if (parent && parent->isLocalFrame()) | 1313 if (parent && parent->isLocalFrame()) |
| 1289 m_policyDocumentLoader->setOverrideEncoding(toLocalFrame(parent)->loader
().documentLoader()->overrideEncoding()); | 1314 m_policyDocumentLoader->setOverrideEncoding(toLocalFrame(parent)->loader
().documentLoader()->overrideEncoding()); |
| 1290 else if (!overrideEncoding.isEmpty()) | 1315 else if (!overrideEncoding.isEmpty()) |
| 1291 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); | 1316 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); |
| 1292 else if (m_documentLoader) | 1317 else if (m_documentLoader) |
| 1293 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn
coding()); | 1318 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn
coding()); |
| 1294 | 1319 |
| 1320 |
| 1321 bool isTransitionNavigation = false; |
| 1322 if (RuntimeEnabledFeatures::navigationTransitionsEnabled()) |
| 1323 isTransitionNavigation = dispatchNavigationTransitionData(); |
| 1324 |
| 1295 // stopAllLoaders can detach the LocalFrame, so protect it. | 1325 // stopAllLoaders can detach the LocalFrame, so protect it. |
| 1296 RefPtr<LocalFrame> protect(m_frame); | 1326 RefPtr<LocalFrame> protect(m_frame); |
| 1297 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho
uldCheckMainWorldContentSecurityPolicy) || !shouldClose()) && m_policyDocumentLo
ader) { | 1327 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho
uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose(
)) && m_policyDocumentLoader) { |
| 1298 m_policyDocumentLoader->detachFromFrame(); | 1328 m_policyDocumentLoader->detachFromFrame(); |
| 1299 m_policyDocumentLoader = nullptr; | 1329 m_policyDocumentLoader = nullptr; |
| 1300 return; | 1330 return; |
| 1301 } | 1331 } |
| 1302 | 1332 |
| 1303 if (m_provisionalDocumentLoader) { | 1333 if (m_provisionalDocumentLoader) { |
| 1304 m_provisionalDocumentLoader->stopLoading(); | 1334 m_provisionalDocumentLoader->stopLoading(); |
| 1305 if (m_provisionalDocumentLoader) | 1335 if (m_provisionalDocumentLoader) |
| 1306 m_provisionalDocumentLoader->detachFromFrame(); | 1336 m_provisionalDocumentLoader->detachFromFrame(); |
| 1307 m_provisionalDocumentLoader = nullptr; | 1337 m_provisionalDocumentLoader = nullptr; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1321 m_loadType = type; | 1351 m_loadType = type; |
| 1322 m_state = FrameStateProvisional; | 1352 m_state = FrameStateProvisional; |
| 1323 | 1353 |
| 1324 if (formState) | 1354 if (formState) |
| 1325 client()->dispatchWillSubmitForm(formState->form()); | 1355 client()->dispatchWillSubmitForm(formState->form()); |
| 1326 | 1356 |
| 1327 m_progressTracker->progressStarted(); | 1357 m_progressTracker->progressStarted(); |
| 1328 if (m_provisionalDocumentLoader->isClientRedirect()) | 1358 if (m_provisionalDocumentLoader->isClientRedirect()) |
| 1329 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); | 1359 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); |
| 1330 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req
uest().url()); | 1360 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req
uest().url()); |
| 1331 client()->dispatchDidStartProvisionalLoad(); | 1361 client()->dispatchDidStartProvisionalLoad(isTransitionNavigation); |
| 1332 ASSERT(m_provisionalDocumentLoader); | 1362 ASSERT(m_provisionalDocumentLoader); |
| 1333 m_provisionalDocumentLoader->startLoadingMainResource(); | 1363 m_provisionalDocumentLoader->startLoadingMainResource(); |
| 1334 } | 1364 } |
| 1335 | 1365 |
| 1336 void FrameLoader::applyUserAgent(ResourceRequest& request) | 1366 void FrameLoader::applyUserAgent(ResourceRequest& request) |
| 1337 { | 1367 { |
| 1338 String userAgent = this->userAgent(request.url()); | 1368 String userAgent = this->userAgent(request.url()); |
| 1339 ASSERT(!userAgent.isNull()); | 1369 ASSERT(!userAgent.isNull()); |
| 1340 request.setHTTPUserAgent(AtomicString(userAgent)); | 1370 request.setHTTPUserAgent(AtomicString(userAgent)); |
| 1341 } | 1371 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1488 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
| 1459 Frame* parentFrame = m_frame->tree().parent(); | 1489 Frame* parentFrame = m_frame->tree().parent(); |
| 1460 if (parentFrame && parentFrame->isLocalFrame()) | 1490 if (parentFrame && parentFrame->isLocalFrame()) |
| 1461 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1491 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
| 1462 if (FrameOwner* frameOwner = m_frame->owner()) | 1492 if (FrameOwner* frameOwner = m_frame->owner()) |
| 1463 flags |= frameOwner->sandboxFlags(); | 1493 flags |= frameOwner->sandboxFlags(); |
| 1464 return flags; | 1494 return flags; |
| 1465 } | 1495 } |
| 1466 | 1496 |
| 1467 } // namespace WebCore | 1497 } // namespace WebCore |
| OLD | NEW |