Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: Source/WebCore/dom/Document.cpp

Issue 7147018: Merge 87756 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/742/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/dom/Document.h ('k') | Source/WebCore/html/MediaDocument.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * 10 *
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 m_document = this; 436 m_document = this;
437 437
438 m_pageGroupUserSheetCacheValid = false; 438 m_pageGroupUserSheetCacheValid = false;
439 439
440 m_printing = false; 440 m_printing = false;
441 m_paginatedForScreen = false; 441 m_paginatedForScreen = false;
442 442
443 m_ignoreAutofocus = false; 443 m_ignoreAutofocus = false;
444 444
445 m_frame = frame; 445 m_frame = frame;
446 m_documentLoader = frame ? frame->loader()->activeDocumentLoader() : 0;
447 446
448 // We depend on the url getting immediately set in subframes, but we 447 // We depend on the url getting immediately set in subframes, but we
449 // also depend on the url NOT getting immediately set in opened windows. 448 // also depend on the url NOT getting immediately set in opened windows.
450 // See fast/dom/early-frame-url.html 449 // See fast/dom/early-frame-url.html
451 // and fast/dom/location-new-window-no-crash.html, respectively. 450 // and fast/dom/location-new-window-no-crash.html, respectively.
452 // FIXME: Can/should we unify this behavior? 451 // FIXME: Can/should we unify this behavior?
453 if ((frame && frame->ownerElement()) || !url.isEmpty()) 452 if ((frame && frame->ownerElement()) || !url.isEmpty())
454 setURL(url); 453 setURL(url);
455 454
456 m_axObjectCache = 0; 455 m_axObjectCache = 0;
(...skipping 3269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 if (m_frame) 3725 if (m_frame)
3727 m_frame->script()->updateSecurityOrigin(); 3726 m_frame->script()->updateSecurityOrigin();
3728 } 3727 }
3729 3728
3730 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified 3729 // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
3731 String Document::lastModified() const 3730 String Document::lastModified() const
3732 { 3731 {
3733 DateComponents date; 3732 DateComponents date;
3734 bool foundDate = false; 3733 bool foundDate = false;
3735 if (m_frame) { 3734 if (m_frame) {
3736 String httpLastModified = m_documentLoader->response().httpHeaderField(" Last-Modified"); 3735 String httpLastModified;
3736 if (DocumentLoader* documentLoader = loader())
3737 httpLastModified = documentLoader->response().httpHeaderField("Last- Modified");
3737 if (!httpLastModified.isEmpty()) { 3738 if (!httpLastModified.isEmpty()) {
3738 date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModified )); 3739 date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModified ));
3739 foundDate = true; 3740 foundDate = true;
3740 } 3741 }
3741 } 3742 }
3742 // FIXME: If this document came from the file system, the HTML5 3743 // FIXME: If this document came from the file system, the HTML5
3743 // specificiation tells us to read the last modification date from the file 3744 // specificiation tells us to read the last modification date from the file
3744 // system. 3745 // system.
3745 if (!foundDate) 3746 if (!foundDate)
3746 date.setMillisecondsSinceEpochForDateTime(currentTimeMS()); 3747 date.setMillisecondsSinceEpochForDateTime(currentTimeMS());
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
4434 // loading URL with a fresh content security policy. 4435 // loading URL with a fresh content security policy.
4435 m_cookieURL = m_url; 4436 m_cookieURL = m_url;
4436 ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::create(m_url, m_fr ame->loader()->sandboxFlags())); 4437 ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::create(m_url, m_fr ame->loader()->sandboxFlags()));
4437 m_contentSecurityPolicy = ContentSecurityPolicy::create(securityOrigin()); 4438 m_contentSecurityPolicy = ContentSecurityPolicy::create(securityOrigin());
4438 4439
4439 if (SecurityOrigin::allowSubstituteDataAccessToLocal()) { 4440 if (SecurityOrigin::allowSubstituteDataAccessToLocal()) {
4440 // If this document was loaded with substituteData, then the document ca n 4441 // If this document was loaded with substituteData, then the document ca n
4441 // load local resources. See https://bugs.webkit.org/show_bug.cgi?id=16 756 4442 // load local resources. See https://bugs.webkit.org/show_bug.cgi?id=16 756
4442 // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further 4443 // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further
4443 // discussion. 4444 // discussion.
4444 if (m_documentLoader->substituteData().isValid()) 4445
4446 DocumentLoader* documentLoader = loader();
4447 if (documentLoader && documentLoader->substituteData().isValid())
4445 securityOrigin()->grantLoadLocalResources(); 4448 securityOrigin()->grantLoadLocalResources();
4446 } 4449 }
4447 4450
4448 if (Settings* settings = this->settings()) { 4451 if (Settings* settings = this->settings()) {
4449 if (!settings->isWebSecurityEnabled()) { 4452 if (!settings->isWebSecurityEnabled()) {
4450 // Web security is turned off. We should let this document access eve ry 4453 // Web security is turned off. We should let this document access eve ry
4451 // other document. This is used primary by testing harnesses for web 4454 // other document. This is used primary by testing harnesses for web
4452 // sites. 4455 // sites.
4453 securityOrigin()->grantUniversalAccess(); 4456 securityOrigin()->grantUniversalAccess();
4454 4457
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4515 } 4518 }
4516 4519
4517 void Document::updateURLForPushOrReplaceState(const KURL& url) 4520 void Document::updateURLForPushOrReplaceState(const KURL& url)
4518 { 4521 {
4519 Frame* f = frame(); 4522 Frame* f = frame();
4520 if (!f) 4523 if (!f)
4521 return; 4524 return;
4522 4525
4523 setURL(url); 4526 setURL(url);
4524 f->loader()->setOutgoingReferrer(url); 4527 f->loader()->setOutgoingReferrer(url);
4525 m_documentLoader->replaceRequestURLForSameDocumentNavigation(url); 4528
4529 if (DocumentLoader* documentLoader = loader())
4530 documentLoader->replaceRequestURLForSameDocumentNavigation(url);
4526 } 4531 }
4527 4532
4528 void Document::statePopped(SerializedScriptValue* stateObject) 4533 void Document::statePopped(SerializedScriptValue* stateObject)
4529 { 4534 {
4530 if (!frame()) 4535 if (!frame())
4531 return; 4536 return;
4532 4537
4533 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we 4538 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we
4534 // defer firing of popstate until we're in the complete state. 4539 // defer firing of popstate until we're in the complete state.
4535 if (m_readyState == Complete) 4540 if (m_readyState == Complete)
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
4981 Frame* frame = window ? window->frame() : this->frame(); 4986 Frame* frame = window ? window->frame() : this->frame();
4982 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag eY); 4987 return Touch::create(frame, target, identifier, screenX, screenY, pageX, pag eY);
4983 } 4988 }
4984 4989
4985 PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const 4990 PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const
4986 { 4991 {
4987 return TouchList::create(); 4992 return TouchList::create();
4988 } 4993 }
4989 #endif 4994 #endif
4990 4995
4996 DocumentLoader* Document::loader() const
4997 {
4998 if (!m_frame)
4999 return 0;
5000
5001 DocumentLoader* loader = m_frame->loader()->activeDocumentLoader();
5002 if (!loader)
5003 return 0;
5004
5005 if (m_frame->document() != this)
5006 return 0;
5007
5008 return loader;
5009 }
5010
4991 } // namespace WebCore 5011 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/dom/Document.h ('k') | Source/WebCore/html/MediaDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698