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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2657623005: WIP: Give developers an opt-in mechanism to block some parser-inserted scripts.
Patch Set: Refactor. Created 3 years, 10 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
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, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 m_xmlVersion("1.0"), 449 m_xmlVersion("1.0"),
450 m_xmlStandalone(StandaloneUnspecified), 450 m_xmlStandalone(StandaloneUnspecified),
451 m_hasXMLDeclaration(0), 451 m_hasXMLDeclaration(0),
452 m_designMode(false), 452 m_designMode(false),
453 m_isRunningExecCommand(false), 453 m_isRunningExecCommand(false),
454 m_hasAnnotatedRegions(false), 454 m_hasAnnotatedRegions(false),
455 m_annotatedRegionsDirty(false), 455 m_annotatedRegionsDirty(false),
456 m_documentClasses(documentClasses), 456 m_documentClasses(documentClasses),
457 m_isViewSource(false), 457 m_isViewSource(false),
458 m_sawElementsInKnownNamespaces(false), 458 m_sawElementsInKnownNamespaces(false),
459 m_isSrcdocDocument(false), 459 m_srcdocType(NotSrcdoc),
460 m_isMobileDocument(false), 460 m_isMobileDocument(false),
461 m_isFragmentParserCreatedSrcdoc(false),
462 m_layoutView(0), 461 m_layoutView(0),
463 m_contextDocument(initializer.contextDocument()), 462 m_contextDocument(initializer.contextDocument()),
464 m_hasFullscreenSupplement(false), 463 m_hasFullscreenSupplement(false),
465 m_loadEventDelayCount(0), 464 m_loadEventDelayCount(0),
466 m_loadEventDelayTimer(TaskRunnerHelper::get(TaskType::Networking, this), 465 m_loadEventDelayTimer(TaskRunnerHelper::get(TaskType::Networking, this),
467 this, 466 this,
468 &Document::loadEventDelayTimerFired), 467 &Document::loadEventDelayTimerFired),
469 m_pluginLoadingTimer( 468 m_pluginLoadingTimer(
470 TaskRunnerHelper::get(TaskType::UnspecedLoading, this), 469 TaskRunnerHelper::get(TaskType::UnspecedLoading, this),
471 this, 470 this,
(...skipping 5002 matching lines...) Expand 10 before | Expand all | Expand 10 after
5474 getSecurityOrigin()->grantUniversalAccess(); 5473 getSecurityOrigin()->grantUniversalAccess();
5475 } else if (!settings->getAllowFileAccessFromFileURLs()) { 5474 } else if (!settings->getAllowFileAccessFromFileURLs()) {
5476 // Some clients do not want local URLs to have access to other local 5475 // Some clients do not want local URLs to have access to other local
5477 // URLs. 5476 // URLs.
5478 getSecurityOrigin()->blockLocalAccessFromLocalOrigin(); 5477 getSecurityOrigin()->blockLocalAccessFromLocalOrigin();
5479 } 5478 }
5480 } 5479 }
5481 } 5480 }
5482 5481
5483 if (initializer.shouldTreatURLAsSrcdocDocument()) { 5482 if (initializer.shouldTreatURLAsSrcdocDocument()) {
5484 m_isSrcdocDocument = true; 5483 m_srcdocType = Srcdoc;
5485 setBaseURLOverride(initializer.parentBaseURL()); 5484 setBaseURLOverride(initializer.parentBaseURL());
5486 5485
5487 if (Element* owner = domWindow()->frameElement()) { 5486 if (Element* owner = domWindow()->frameElement()) {
5488 HTMLIFrameElement* iframe = toHTMLIFrameElement(owner); 5487 HTMLIFrameElement* iframe = toHTMLIFrameElement(owner);
5489 m_isFragmentParserCreatedSrcdoc = 5488 if (iframe->createdByFragmentParser() ||
5490 iframe->createdByFragmentParser() || 5489 iframe->document().isFragmentParserCreatedSrcdoc()) {
5491 iframe->document().isFragmentParserCreatedSrcdoc(); 5490 m_srcdocType = FragmentParserCreatedSrcdoc;
5491 } else if (iframe->createdByDocumentWrite() ||
5492 iframe->document().isDocumentWriteCreatedSrcdoc()) {
5493 m_srcdocType = DocumentWriteCreatedSrcdoc;
5494 }
5492 } 5495 }
5493 } 5496 }
5494 5497
5495 if (getSecurityOrigin()->isUnique() && 5498 if (getSecurityOrigin()->isUnique() &&
5496 SecurityOrigin::create(m_url)->isPotentiallyTrustworthy()) 5499 SecurityOrigin::create(m_url)->isPotentiallyTrustworthy())
5497 getSecurityOrigin()->setUniqueOriginIsPotentiallyTrustworthy(true); 5500 getSecurityOrigin()->setUniqueOriginIsPotentiallyTrustworthy(true);
5498 5501
5499 if (getSecurityOrigin()->hasSuborigin()) 5502 if (getSecurityOrigin()->hasSuborigin())
5500 enforceSuborigin(*getSecurityOrigin()->suborigin()); 5503 enforceSuborigin(*getSecurityOrigin()->suborigin());
5501 } 5504 }
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
6543 } 6546 }
6544 6547
6545 void showLiveDocumentInstances() { 6548 void showLiveDocumentInstances() {
6546 WeakDocumentSet& set = liveDocumentSet(); 6549 WeakDocumentSet& set = liveDocumentSet();
6547 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6550 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6548 for (Document* document : set) 6551 for (Document* document : set)
6549 fprintf(stderr, "- Document %p URL: %s\n", document, 6552 fprintf(stderr, "- Document %p URL: %s\n", document,
6550 document->url().getString().utf8().data()); 6553 document->url().getString().utf8().data());
6551 } 6554 }
6552 #endif 6555 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698