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

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

Issue 2036103003: [DurableStorage] Enable origin trial on workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding navigator durable bindings to shared/dedicated/service workers Created 4 years, 6 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 OriginTrialContext* originTrialContext = OriginTrialContext::from(executionC ontext, OriginTrialContext::DontCreateIfNotExists); 539 OriginTrialContext* originTrialContext = OriginTrialContext::from(executionC ontext, OriginTrialContext::DontCreateIfNotExists);
540 if (!originTrialContext) 540 if (!originTrialContext)
541 return; 541 return;
542 542
543 ScriptState::Scope scope(scriptState); 543 ScriptState::Scope scope(scriptState);
544 v8::Local<v8::Object> global = context->Global(); 544 v8::Local<v8::Object> global = context->Global();
545 v8::Isolate* isolate = scriptState->isolate(); 545 v8::Isolate* isolate = scriptState->isolate();
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", nullptr))) {
548 if (executionContext->isDocument()) { 548 if (executionContext->isDocument()) {
549 v8::Local<v8::String> navigatorName = v8::String::NewFromOneByte(iso late, reinterpret_cast<const uint8_t*>("navigator"), v8::NewStringType::kNormal) .ToLocalChecked(); 549 v8::Local<v8::String> navigatorName = v8::String::NewFromOneByte(iso late, reinterpret_cast<const uint8_t*>("navigator"), v8::NewStringType::kNormal) .ToLocalChecked();
Marijn Kruisselbrink 2016/06/03 23:36:01 You probably want to move this to outside the if s
dmurph 2016/06/06 18:22:55 Done.
550 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject(); 550 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject();
551 V8WindowPartial::installDurableStorage(scriptState, global); 551 V8WindowPartial::installDurableStorage(scriptState, global);
552 V8NavigatorPartial::installDurableStorage(scriptState, navigator); 552 V8NavigatorPartial::installDurableStorage(scriptState, navigator);
553 } else if (executionContext->isSharedWorkerGlobalScope()) { 553 } else if (executionContext->isSharedWorkerGlobalScope()) {
554 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject();
554 V8SharedWorkerGlobalScopePartial::installDurableStorage(scriptState, global); 555 V8SharedWorkerGlobalScopePartial::installDurableStorage(scriptState, global);
556 V8NavigatorPartial::installDurableStorage(scriptState, navigator);
Marijn Kruisselbrink 2016/06/03 23:36:01 These need to be V8WorkerNavigatorPartial I think.
dmurph 2016/06/06 18:22:55 Done.
555 } else if (executionContext->isDedicatedWorkerGlobalScope()) { 557 } else if (executionContext->isDedicatedWorkerGlobalScope()) {
558 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject();
556 V8DedicatedWorkerGlobalScopePartial::installDurableStorage(scriptSta te, global); 559 V8DedicatedWorkerGlobalScopePartial::installDurableStorage(scriptSta te, global);
560 V8NavigatorPartial::installDurableStorage(scriptState, navigator);
557 } else if (executionContext->isServiceWorkerGlobalScope()) { 561 } else if (executionContext->isServiceWorkerGlobalScope()) {
562 v8::Local<v8::Object> navigator = global->Get(context, navigatorName ).ToLocalChecked()->ToObject();
558 V8ServiceWorkerGlobalScope::installDurableStorage(scriptState, globa l); 563 V8ServiceWorkerGlobalScope::installDurableStorage(scriptState, globa l);
564 V8NavigatorPartial::installDurableStorage(scriptState, navigator);
559 } 565 }
560 originTrialContext->setFeatureBindingsInstalled("DurableStorage"); 566 originTrialContext->setFeatureBindingsInstalled("DurableStorage");
561 } 567 }
562 } 568 }
563 569
564 void registerInstallOriginTrialsForModules() 570 void registerInstallOriginTrialsForModules()
565 { 571 {
566 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst allOriginTrialsForModules); 572 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst allOriginTrialsForModules);
567 } 573 }
568 } // namespace blink 574 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698