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

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

Issue 2640983005: Inline Document::allowExecutingScripts logic (Closed)
Patch Set: yukishiino Created 3 years, 11 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 5540 matching lines...) Expand 10 before | Expand all | Expand 10 after
5551 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) 5551 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
5552 return false; 5552 return false;
5553 if (node && node->document() != this && 5553 if (node && node->document() != this &&
5554 !node->document().allowInlineEventHandler(node, listener, contextURL, 5554 !node->document().allowInlineEventHandler(node, listener, contextURL,
5555 contextLine)) 5555 contextLine))
5556 return false; 5556 return false;
5557 5557
5558 return true; 5558 return true;
5559 } 5559 }
5560 5560
5561 bool Document::allowExecutingScripts(Node* node) {
5562 // FIXME: Eventually we'd like to evaluate scripts which are inserted into a
5563 // viewless document but this'll do for now.
5564 // See http://bugs.webkit.org/show_bug.cgi?id=5727
5565 LocalFrame* frame = executingFrame();
5566 if (!frame)
5567 return false;
5568 if (!node->document().executingFrame())
5569 return false;
5570 if (!frame->script().canExecuteScripts(AboutToExecuteScript))
5571 return false;
5572 return true;
5573 }
5574
5575 void Document::enforceSandboxFlags(SandboxFlags mask) { 5561 void Document::enforceSandboxFlags(SandboxFlags mask) {
5576 RefPtr<SecurityOrigin> standInOrigin = getSecurityOrigin(); 5562 RefPtr<SecurityOrigin> standInOrigin = getSecurityOrigin();
5577 applySandboxFlags(mask); 5563 applySandboxFlags(mask);
5578 // Send a notification if the origin has been updated. 5564 // Send a notification if the origin has been updated.
5579 if (standInOrigin && !standInOrigin->isUnique() && 5565 if (standInOrigin && !standInOrigin->isUnique() &&
5580 getSecurityOrigin()->isUnique()) { 5566 getSecurityOrigin()->isUnique()) {
5581 getSecurityOrigin()->setUniqueOriginIsPotentiallyTrustworthy( 5567 getSecurityOrigin()->setUniqueOriginIsPotentiallyTrustworthy(
5582 standInOrigin->isPotentiallyTrustworthy()); 5568 standInOrigin->isPotentiallyTrustworthy());
5583 if (frame()) 5569 if (frame())
5584 frame()->loader().client()->didUpdateToUniqueOrigin(); 5570 frame()->loader().client()->didUpdateToUniqueOrigin();
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
6533 } 6519 }
6534 6520
6535 void showLiveDocumentInstances() { 6521 void showLiveDocumentInstances() {
6536 WeakDocumentSet& set = liveDocumentSet(); 6522 WeakDocumentSet& set = liveDocumentSet();
6537 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6523 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6538 for (Document* document : set) 6524 for (Document* document : set)
6539 fprintf(stderr, "- Document %p URL: %s\n", document, 6525 fprintf(stderr, "- Document %p URL: %s\n", document,
6540 document->url().getString().utf8().data()); 6526 document->url().getString().utf8().data());
6541 } 6527 }
6542 #endif 6528 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698