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 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
rome(), didAllowNavigation)) | 1274 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
rome(), didAllowNavigation)) |
1275 break; | 1275 break; |
1276 } | 1276 } |
1277 | 1277 |
1278 if (i == targetFrames.size()) | 1278 if (i == targetFrames.size()) |
1279 shouldClose = true; | 1279 shouldClose = true; |
1280 } | 1280 } |
1281 return shouldClose; | 1281 return shouldClose; |
1282 } | 1282 } |
1283 | 1283 |
| 1284 bool FrameLoader::validateTransitionNavigationMode() |
| 1285 { |
| 1286 if (frame()->document()->inQuirksMode()) { |
| 1287 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessageLeve
l, "Ignoring transition elements due to quirks mode."); |
| 1288 return false; |
| 1289 } |
| 1290 |
| 1291 // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/sc
aling issues. |
| 1292 return true; |
| 1293 } |
| 1294 |
| 1295 bool FrameLoader::dispatchNavigationTransitionData() |
| 1296 { |
| 1297 Vector<Document::TransitionElementData> elementData; |
| 1298 frame()->document()->getTransitionElementData(elementData, IGNORE_EXCEPTION)
; |
| 1299 if (elementData.isEmpty() || !validateTransitionNavigationMode()) |
| 1300 return false; |
| 1301 |
| 1302 Vector<Document::TransitionElementData>::iterator iter = elementData.begin()
; |
| 1303 for (; iter != elementData.end(); ++iter) |
| 1304 client()->dispatchAddNavigationTransitionData(iter->scope, iter->markup)
; |
| 1305 |
| 1306 return true; |
| 1307 } |
| 1308 |
1284 void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame
LoadType type, PassRefPtrWillBeRawPtr<FormState> formState, const SubstituteData
& substituteData, ClientRedirectPolicy clientRedirect, const AtomicString& overr
ideEncoding) | 1309 void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame
LoadType type, PassRefPtrWillBeRawPtr<FormState> formState, const SubstituteData
& substituteData, ClientRedirectPolicy clientRedirect, const AtomicString& overr
ideEncoding) |
1285 { | 1310 { |
1286 ASSERT(client()->hasWebView()); | 1311 ASSERT(client()->hasWebView()); |
1287 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) | 1312 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) |
1288 return; | 1313 return; |
1289 | 1314 |
1290 const ResourceRequest& request = action.resourceRequest(); | 1315 const ResourceRequest& request = action.resourceRequest(); |
1291 | 1316 |
1292 // The current load should replace the history item if it is the first real | 1317 // The current load should replace the history item if it is the first real |
1293 // load of the frame. | 1318 // load of the frame. |
1294 bool replacesCurrentHistoryItem = false; | 1319 bool replacesCurrentHistoryItem = false; |
1295 if (type == FrameLoadTypeRedirectWithLockedBackForwardList | 1320 if (type == FrameLoadTypeRedirectWithLockedBackForwardList |
1296 || !m_stateMachine.committedFirstRealDocumentLoad()) { | 1321 || !m_stateMachine.committedFirstRealDocumentLoad()) { |
1297 replacesCurrentHistoryItem = true; | 1322 replacesCurrentHistoryItem = true; |
1298 } | 1323 } |
1299 | 1324 |
1300 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, su
bstituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.ur
l())); | 1325 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, su
bstituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.ur
l())); |
1301 m_policyDocumentLoader->setTriggeringAction(action); | 1326 m_policyDocumentLoader->setTriggeringAction(action); |
1302 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory
Item); | 1327 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory
Item); |
1303 m_policyDocumentLoader->setIsClientRedirect(clientRedirect == ClientRedirect
); | 1328 m_policyDocumentLoader->setIsClientRedirect(clientRedirect == ClientRedirect
); |
1304 | 1329 |
1305 Frame* parent = m_frame->tree().parent(); | 1330 Frame* parent = m_frame->tree().parent(); |
1306 if (parent && parent->isLocalFrame()) | 1331 if (parent && parent->isLocalFrame()) |
1307 m_policyDocumentLoader->setOverrideEncoding(toLocalFrame(parent)->loader
().documentLoader()->overrideEncoding()); | 1332 m_policyDocumentLoader->setOverrideEncoding(toLocalFrame(parent)->loader
().documentLoader()->overrideEncoding()); |
1308 else if (!overrideEncoding.isEmpty()) | 1333 else if (!overrideEncoding.isEmpty()) |
1309 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); | 1334 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); |
1310 else if (m_documentLoader) | 1335 else if (m_documentLoader) |
1311 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn
coding()); | 1336 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn
coding()); |
1312 | 1337 |
| 1338 |
| 1339 bool isTransitionNavigation = false; |
| 1340 if (RuntimeEnabledFeatures::navigationTransitionsEnabled()) |
| 1341 isTransitionNavigation = dispatchNavigationTransitionData(); |
| 1342 |
1313 // stopAllLoaders can detach the LocalFrame, so protect it. | 1343 // stopAllLoaders can detach the LocalFrame, so protect it. |
1314 RefPtr<LocalFrame> protect(m_frame); | 1344 RefPtr<LocalFrame> protect(m_frame); |
1315 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request) ||
!shouldClose()) && m_policyDocumentLoader) { | 1345 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, isT
ransitionNavigation) || !shouldClose()) && m_policyDocumentLoader) { |
1316 m_policyDocumentLoader->detachFromFrame(); | 1346 m_policyDocumentLoader->detachFromFrame(); |
1317 m_policyDocumentLoader = nullptr; | 1347 m_policyDocumentLoader = nullptr; |
1318 return; | 1348 return; |
1319 } | 1349 } |
1320 | 1350 |
1321 if (m_provisionalDocumentLoader) { | 1351 if (m_provisionalDocumentLoader) { |
1322 m_provisionalDocumentLoader->stopLoading(); | 1352 m_provisionalDocumentLoader->stopLoading(); |
1323 if (m_provisionalDocumentLoader) | 1353 if (m_provisionalDocumentLoader) |
1324 m_provisionalDocumentLoader->detachFromFrame(); | 1354 m_provisionalDocumentLoader->detachFromFrame(); |
1325 m_provisionalDocumentLoader = nullptr; | 1355 m_provisionalDocumentLoader = nullptr; |
(...skipping 13 matching lines...) Expand all Loading... |
1339 m_loadType = type; | 1369 m_loadType = type; |
1340 m_state = FrameStateProvisional; | 1370 m_state = FrameStateProvisional; |
1341 | 1371 |
1342 if (formState) | 1372 if (formState) |
1343 client()->dispatchWillSubmitForm(formState->form()); | 1373 client()->dispatchWillSubmitForm(formState->form()); |
1344 | 1374 |
1345 m_progressTracker->progressStarted(); | 1375 m_progressTracker->progressStarted(); |
1346 if (m_provisionalDocumentLoader->isClientRedirect()) | 1376 if (m_provisionalDocumentLoader->isClientRedirect()) |
1347 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); | 1377 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); |
1348 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req
uest().url()); | 1378 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req
uest().url()); |
1349 client()->dispatchDidStartProvisionalLoad(); | 1379 client()->dispatchDidStartProvisionalLoad(isTransitionNavigation); |
1350 ASSERT(m_provisionalDocumentLoader); | 1380 ASSERT(m_provisionalDocumentLoader); |
1351 m_provisionalDocumentLoader->startLoadingMainResource(); | 1381 m_provisionalDocumentLoader->startLoadingMainResource(); |
1352 } | 1382 } |
1353 | 1383 |
1354 void FrameLoader::applyUserAgent(ResourceRequest& request) | 1384 void FrameLoader::applyUserAgent(ResourceRequest& request) |
1355 { | 1385 { |
1356 String userAgent = this->userAgent(request.url()); | 1386 String userAgent = this->userAgent(request.url()); |
1357 ASSERT(!userAgent.isNull()); | 1387 ASSERT(!userAgent.isNull()); |
1358 request.setHTTPUserAgent(AtomicString(userAgent)); | 1388 request.setHTTPUserAgent(AtomicString(userAgent)); |
1359 } | 1389 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1504 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
1475 Frame* parentFrame = m_frame->tree().parent(); | 1505 Frame* parentFrame = m_frame->tree().parent(); |
1476 if (parentFrame && parentFrame->isLocalFrame()) | 1506 if (parentFrame && parentFrame->isLocalFrame()) |
1477 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1507 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
1478 if (FrameOwner* frameOwner = m_frame->owner()) | 1508 if (FrameOwner* frameOwner = m_frame->owner()) |
1479 flags |= frameOwner->sandboxFlags(); | 1509 flags |= frameOwner->sandboxFlags(); |
1480 return flags; | 1510 return flags; |
1481 } | 1511 } |
1482 | 1512 |
1483 } // namespace WebCore | 1513 } // namespace WebCore |
OLD | NEW |