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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp

Issue 2123323004: Simplify OriginTrialContext and the way it validates tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: filter empty tokens in addTokens, and DCHECK in validateToken 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 v8::Local<v8::Context> context = scriptState->context(); 538 v8::Local<v8::Context> context = scriptState->context();
539 ExecutionContext* executionContext = toExecutionContext(context); 539 ExecutionContext* executionContext = toExecutionContext(context);
540 OriginTrialContext* originTrialContext = OriginTrialContext::from(executionC ontext, OriginTrialContext::DontCreateIfNotExists); 540 OriginTrialContext* originTrialContext = OriginTrialContext::from(executionC ontext, OriginTrialContext::DontCreateIfNotExists);
541 if (!originTrialContext) 541 if (!originTrialContext)
542 return; 542 return;
543 543
544 ScriptState::Scope scope(scriptState); 544 ScriptState::Scope scope(scriptState);
545 v8::Local<v8::Object> global = context->Global(); 545 v8::Local<v8::Object> global = context->Global();
546 546
547 if (!originTrialContext->featureBindingsInstalled("DurableStorage") && (Runt imeEnabledFeatures::durableStorageEnabled() || originTrialContext->isFeatureEnab led("DurableStorage", nullptr))) { 547 if (!originTrialContext->featureBindingsInstalled("DurableStorage") && (Runt imeEnabledFeatures::durableStorageEnabled() || originTrialContext->isFeatureEnab led("DurableStorage"))) {
548 if (executionContext->isDocument()) { 548 if (executionContext->isDocument()) {
549 V8WindowPartial::installDurableStorage(scriptState, global); 549 V8WindowPartial::installDurableStorage(scriptState, global);
550 V8NavigatorPartial::installDurableStorage(scriptState); 550 V8NavigatorPartial::installDurableStorage(scriptState);
551 } else if (executionContext->isSharedWorkerGlobalScope()) { 551 } else if (executionContext->isSharedWorkerGlobalScope()) {
552 V8SharedWorkerGlobalScopePartial::installDurableStorage(scriptState, global); 552 V8SharedWorkerGlobalScopePartial::installDurableStorage(scriptState, global);
553 V8WorkerNavigatorPartial::installDurableStorage(scriptState); 553 V8WorkerNavigatorPartial::installDurableStorage(scriptState);
554 } else if (executionContext->isDedicatedWorkerGlobalScope()) { 554 } else if (executionContext->isDedicatedWorkerGlobalScope()) {
555 V8DedicatedWorkerGlobalScopePartial::installDurableStorage(scriptSta te, global); 555 V8DedicatedWorkerGlobalScopePartial::installDurableStorage(scriptSta te, global);
556 V8WorkerNavigatorPartial::installDurableStorage(scriptState); 556 V8WorkerNavigatorPartial::installDurableStorage(scriptState);
557 } else if (executionContext->isServiceWorkerGlobalScope()) { 557 } else if (executionContext->isServiceWorkerGlobalScope()) {
558 V8ServiceWorkerGlobalScope::installDurableStorage(scriptState, globa l); 558 V8ServiceWorkerGlobalScope::installDurableStorage(scriptState, globa l);
559 V8WorkerNavigatorPartial::installDurableStorage(scriptState); 559 V8WorkerNavigatorPartial::installDurableStorage(scriptState);
560 } 560 }
561 } 561 }
562 562
563 if (!originTrialContext->featureBindingsInstalled("WebBluetooth") && (Runtim eEnabledFeatures::webBluetoothEnabled() || originTrialContext->isFeatureEnabled( "WebBluetooth", nullptr))) { 563 if (!originTrialContext->featureBindingsInstalled("WebBluetooth") && (Runtim eEnabledFeatures::webBluetoothEnabled() || originTrialContext->isFeatureEnabled( "WebBluetooth"))) {
564 if (executionContext->isDocument()) { 564 if (executionContext->isDocument()) {
565 // For global interfaces e.g. BluetoothUUID. 565 // For global interfaces e.g. BluetoothUUID.
566 V8WindowPartial::installWebBluetooth(scriptState, global); 566 V8WindowPartial::installWebBluetooth(scriptState, global);
567 // For navigator interfaces e.g. navigator.bluetooth. 567 // For navigator interfaces e.g. navigator.bluetooth.
568 V8NavigatorPartial::installWebBluetooth(scriptState); 568 V8NavigatorPartial::installWebBluetooth(scriptState);
569 } 569 }
570 } 570 }
571 } 571 }
572 572
573 void registerInstallOriginTrialsForModules() 573 void registerInstallOriginTrialsForModules()
574 { 574 {
575 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst allOriginTrialsForModules); 575 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst allOriginTrialsForModules);
576 } 576 }
577 } // namespace blink 577 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698