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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const ExecutionCo
ntext* context, Feature feature) | 732 void UseCounter::countIfNotPrivateScript(v8::Isolate* isolate, const ExecutionCo
ntext* context, Feature feature) |
733 { | 733 { |
734 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) | 734 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) |
735 return; | 735 return; |
736 UseCounter::count(context, feature); | 736 UseCounter::count(context, feature); |
737 } | 737 } |
738 | 738 |
739 void UseCounter::countCrossOriginIframe(const Document& document, Feature featur
e) | 739 void UseCounter::countCrossOriginIframe(const Document& document, Feature featur
e) |
740 { | 740 { |
741 Frame* frame = document.frame(); | 741 Frame* frame = document.frame(); |
742 if (!frame) | 742 if (frame && frame->isCrossOrigin()) |
743 return; | |
744 // Check to see if the frame can script into the top level document. | |
745 SecurityOrigin* securityOrigin = frame->securityContext()->getSecurityOrigin
(); | |
746 Frame* top = frame->tree().top(); | |
747 if (top && !securityOrigin->canAccess(top->securityContext()->getSecurityOri
gin())) | |
748 count(frame, feature); | 743 count(frame, feature); |
749 } | 744 } |
750 | 745 |
751 void UseCounter::count(CSSParserMode cssParserMode, CSSPropertyID feature) | 746 void UseCounter::count(CSSParserMode cssParserMode, CSSPropertyID feature) |
752 { | 747 { |
753 ASSERT(feature >= firstCSSProperty); | 748 ASSERT(feature >= firstCSSProperty); |
754 ASSERT(feature <= lastUnresolvedCSSProperty); | 749 ASSERT(feature <= lastUnresolvedCSSProperty); |
755 | 750 |
756 if (!isUseCounterEnabledForMode(cssParserMode)) | 751 if (!isUseCounterEnabledForMode(cssParserMode)) |
757 return; | 752 return; |
(...skipping 24 matching lines...) Expand all Loading... |
782 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) | 777 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) |
783 { | 778 { |
784 // FIXME: We may want to handle stylesheets that have multiple owners | 779 // FIXME: We may want to handle stylesheets that have multiple owners |
785 // https://crbug.com/242125 | 780 // https://crbug.com/242125 |
786 if (sheetContents && sheetContents->hasSingleOwnerNode()) | 781 if (sheetContents && sheetContents->hasSingleOwnerNode()) |
787 return getFrom(sheetContents->singleOwnerDocument()); | 782 return getFrom(sheetContents->singleOwnerDocument()); |
788 return 0; | 783 return 0; |
789 } | 784 } |
790 | 785 |
791 } // namespace blink | 786 } // namespace blink |
OLD | NEW |