OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google, Inc. All rights reserved. | 2 * Copyright (C) 2012 Google, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const ExecutionCo
ntext* context, Feature feature) | 733 void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const ExecutionCo
ntext* context, Feature feature) |
734 { | 734 { |
735 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) | 735 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) |
736 return; | 736 return; |
737 UseCounter::count(context, feature); | 737 UseCounter::count(context, feature); |
738 } | 738 } |
739 | 739 |
740 void UseCounter::countCrossOriginIframe(const Document& document, Feature featur
e) | 740 void UseCounter::countCrossOriginIframe(const Document& document, Feature featur
e) |
741 { | 741 { |
742 Frame* frame = document.frame(); | 742 Frame* frame = document.frame(); |
743 if (!frame) | 743 if (frame && frame->isCrossOrigin()) |
744 return; | |
745 // Check to see if the frame can script into the top level document. | |
746 SecurityOrigin* securityOrigin = frame->securityContext()->getSecurityOrigin
(); | |
747 Frame* top = frame->tree().top(); | |
748 if (top && !securityOrigin->canAccess(top->securityContext()->getSecurityOri
gin())) | |
749 count(frame, feature); | 744 count(frame, feature); |
750 } | 745 } |
751 | 746 |
752 void UseCounter::count(CSSParserMode cssParserMode, CSSPropertyID feature) | 747 void UseCounter::count(CSSParserMode cssParserMode, CSSPropertyID feature) |
753 { | 748 { |
754 ASSERT(feature >= firstCSSProperty); | 749 ASSERT(feature >= firstCSSProperty); |
755 ASSERT(feature <= lastUnresolvedCSSProperty); | 750 ASSERT(feature <= lastUnresolvedCSSProperty); |
756 | 751 |
757 if (!isUseCounterEnabledForMode(cssParserMode)) | 752 if (!isUseCounterEnabledForMode(cssParserMode)) |
758 return; | 753 return; |
(...skipping 24 matching lines...) Expand all Loading... |
783 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) | 778 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) |
784 { | 779 { |
785 // FIXME: We may want to handle stylesheets that have multiple owners | 780 // FIXME: We may want to handle stylesheets that have multiple owners |
786 // https://crbug.com/242125 | 781 // https://crbug.com/242125 |
787 if (sheetContents && sheetContents->hasSingleOwnerNode()) | 782 if (sheetContents && sheetContents->hasSingleOwnerNode()) |
788 return getFrom(sheetContents->singleOwnerDocument()); | 783 return getFrom(sheetContents->singleOwnerDocument()); |
789 return 0; | 784 return 0; |
790 } | 785 } |
791 | 786 |
792 } // namespace blink | 787 } // namespace blink |
OLD | NEW |