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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp

Issue 2096663002: [Origin Trials] Only flag feature bindings installed after all install methods have returned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "core/dom/Element.h" 50 #include "core/dom/Element.h"
51 #include "core/dom/FlexibleArrayBufferView.h" 51 #include "core/dom/FlexibleArrayBufferView.h"
52 #include "core/dom/NodeFilter.h" 52 #include "core/dom/NodeFilter.h"
53 #include "core/dom/QualifiedName.h" 53 #include "core/dom/QualifiedName.h"
54 #include "core/frame/LocalDOMWindow.h" 54 #include "core/frame/LocalDOMWindow.h"
55 #include "core/frame/LocalFrame.h" 55 #include "core/frame/LocalFrame.h"
56 #include "core/frame/Settings.h" 56 #include "core/frame/Settings.h"
57 #include "core/inspector/InspectorTraceEvents.h" 57 #include "core/inspector/InspectorTraceEvents.h"
58 #include "core/loader/FrameLoader.h" 58 #include "core/loader/FrameLoader.h"
59 #include "core/loader/FrameLoaderClient.h" 59 #include "core/loader/FrameLoaderClient.h"
60 #include "core/origin_trials/OriginTrialContext.h"
60 #include "core/workers/WorkerGlobalScope.h" 61 #include "core/workers/WorkerGlobalScope.h"
61 #include "core/workers/WorkletGlobalScope.h" 62 #include "core/workers/WorkletGlobalScope.h"
62 #include "core/xml/XPathNSResolver.h" 63 #include "core/xml/XPathNSResolver.h"
63 #include "platform/TracedValue.h" 64 #include "platform/TracedValue.h"
64 #include "wtf/MathExtras.h" 65 #include "wtf/MathExtras.h"
65 #include "wtf/StdLibExtras.h" 66 #include "wtf/StdLibExtras.h"
66 #include "wtf/Threading.h" 67 #include "wtf/Threading.h"
67 #include "wtf/text/AtomicString.h" 68 #include "wtf/text/AtomicString.h"
68 #include "wtf/text/CString.h" 69 #include "wtf/text/CString.h"
69 #include "wtf/text/CharacterNames.h" 70 #include "wtf/text/CharacterNames.h"
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 // Initialization code for origin trials for core bindings, if necessary, 812 // Initialization code for origin trials for core bindings, if necessary,
812 // should go here. 813 // should go here.
813 } 814 }
814 815
815 namespace { 816 namespace {
816 InstallOriginTrialsFunction s_installOriginTrialsFunction = &installOriginTrials Core; 817 InstallOriginTrialsFunction s_installOriginTrialsFunction = &installOriginTrials Core;
817 } 818 }
818 819
819 void installOriginTrials(ScriptState* scriptState) 820 void installOriginTrials(ScriptState* scriptState)
820 { 821 {
822 v8::Local<v8::Context> context = scriptState->context();
823 ExecutionContext* executionContext = toExecutionContext(context);
824 OriginTrialContext* originTrialContext = OriginTrialContext::from(executionC ontext, OriginTrialContext::DontCreateIfNotExists);
825 if (!originTrialContext)
826 return;
827
828 ScriptState::Scope scope(scriptState);
829
821 (*s_installOriginTrialsFunction)(scriptState); 830 (*s_installOriginTrialsFunction)(scriptState);
831
832 // Mark each enabled feature as having been installed.
833 if (!originTrialContext->featureBindingsInstalled("DurableStorage") && (Runt imeEnabledFeatures::durableStorageEnabled() || originTrialContext->isFeatureEnab led("DurableStorage", nullptr))) {
834 originTrialContext->setFeatureBindingsInstalled("DurableStorage");
835 }
822 } 836 }
823 837
824 InstallOriginTrialsFunction setInstallOriginTrialsFunction(InstallOriginTrialsFu nction newInstallOriginTrialsFunction) 838 InstallOriginTrialsFunction setInstallOriginTrialsFunction(InstallOriginTrialsFu nction newInstallOriginTrialsFunction)
825 { 839 {
826 InstallOriginTrialsFunction originalFunction = s_installOriginTrialsFunction ; 840 InstallOriginTrialsFunction originalFunction = s_installOriginTrialsFunction ;
827 s_installOriginTrialsFunction = newInstallOriginTrialsFunction; 841 s_installOriginTrialsFunction = newInstallOriginTrialsFunction;
828 return originalFunction; 842 return originalFunction;
829 } 843 }
830 844
831 void crashIfIsolateIsDead(v8::Isolate* isolate) 845 void crashIfIsolateIsDead(v8::Isolate* isolate)
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); 944 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
931 } 945 }
932 946
933 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso late) 947 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso late)
934 { 948 {
935 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC ontext(), v8::IntegrityLevel::kFrozen)); 949 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC ontext(), v8::IntegrityLevel::kFrozen));
936 return value; 950 return value;
937 } 951 }
938 952
939 } // namespace blink 953 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698