Javascript Variables non-Persistence

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Javascript Variables non-Persistence

Postby tslate » Tue Jan 02, 2018 9:04 am

I load all JS via register extension OnWebKitInitialized just once, one JS file. Before page loading begins all initialization variables are set within the same domain. Per page load the initialization variables have been reset when trying to call functions that should contain the initialization values but they are empty variables. So obviously the all page available JS extension also means resetting variables per page load.

I tested in the same machines Chrome browser that I run this application on by loading pages using both setting/getting from session and local storage with no problems.

I've tried various methods including using session and/or local storage both of which return access denied and I can find no settings for this other than --disable-local-storage which I don't use.
Are there any options to persist variables after pre-setting them within extension JS before page loading starts as opposed to setting these values for every page load? Is there a CEF/Chromium setting to enable local storage?



Thanks

Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.

Initial cmd line I start with:
[0102/081945.040:INFO:wfbpdfe.cc(104)] Command line next arg: --disable-extensions

[0102/081945.040:INFO:wfbpdfe.cc(104)] Command line next arg: --multi-threaded-message-loop

[0102/081945.040:INFO:wfbpdfe.cc(104)] Command line next arg: --no-sandbox

[0102/081945.040:INFO:wfbpdfe.cc(104)] Command line next arg: --allow-file-access-from-files

Then CEF starts internally another instance(s) with this command line:

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --type=gpu-process

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --no-sandbox

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --lang=en-US

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --disable-direct-composition

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --supports-dual-gpus=false

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --gpu-driver-bug-workarounds=7,10,11,19,20,21,24,26,43,63,76

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --disable-gl-extensions=GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --gpu-vendor-id=0x8086

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --gpu-device-id=0x1912

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --gpu-driver-vendor=Intel Corporation

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --gpu-driver-version=21.20.16.4541

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --gpu-driver-date=10-20-2016

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --gpu-secondary-vendor-ids=0x0000

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --gpu-secondary-device-ids=0x0000

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --lang=en-US

[0102/081945.309:INFO:wfbpdfe.cc(104)] Command line next arg: --service-request-channel-token=C6F0633CFC21B7799F86CD897DB88289

[0102/081945.310:INFO:wfbpdfe.cc(104)] Command line next arg: --mojo-platform-channel-handle=1232

[0102/081945.310:INFO:wfbpdfe.cc(104)] Command line next arg: /prefetch:2
tslate
Techie
 
Posts: 32
Joined: Wed Jul 19, 2017 12:47 pm

Re: Javascript Variables non-Persistence

Postby magreenblatt » Tue Jan 02, 2018 1:56 pm

Code specified via CefRegisterExtension will be loaded into each page before the DOM is created. Any state created by that code is not persisted between page loads and the code cannot access storage until after the DOM has been created. You can, for example, call your extension function from the <html onload> event if you want to access storage.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: Javascript Variables non-Persistence

Postby tslate » Thu Jan 04, 2018 12:29 pm

Thanks, I was using about:blank as an initial dummy page which is why, otherwise storage works on a DOM based page.
tslate
Techie
 
Posts: 32
Joined: Wed Jul 19, 2017 12:47 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 69 guests