obsproject / obs-browser

CEF-based OBS Studio browser plugin
GNU General Public License v2.0
776 stars 220 forks source link

CefSettings web_security no longer exists in CEF >= 91 #305

Closed OceanS2000 closed 2 years ago

OceanS2000 commented 3 years ago

Operating System Info

Other

Other OS

Gentoo Linux

OBS Studio Version

Git

OBS Studio Version (Other)

No response

OBS Studio Log URL

Failed to build, build log attached below

OBS Studio Crash Log URL

No response

Expected Behavior

The in tree plugin build successfully with -DBUILD_BROWSER=ON

Current Behavior

Build failed with

[1/2] Building CXX object plugins/obs-browser/CMakeFiles/obs-browser.dir/obs-browser-source.cpp.o
FAILED: plugins/obs-browser/CMakeFiles/obs-browser.dir/obs-browser-source.cpp.o 
/usr/bin/c++ -DHAVE_OBSCONFIG_H -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DUSE_XDG -Dobs_browser_EXPORTS -Iplugins/obs-browser -I/home/ocean/Code/obs/obs-studio/plugins/obs-browser -Iplugins/obs-browser/obs-browser_autogen/include -I/home/ocean/Code/obs/obs-studio/plugins/obs-browser/deps -I/tmp/cef_binary_91.1.23+g04c8d56+chromium-91.0.4472.164_linux64_minimal -I/home/ocean/Code/obs/obs-studio/libobs -Iconfig -isystem /home/ocean/Code/obs/obs-studio/UI/obs-frontend-api -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -Wall -Wextra -Wvla -Wno-unused-function -Wno-missing-field-initializers  -fno-strict-aliasing -O3 -DNDEBUG -fPIC -mmmx -msse -msse2 -pthread -fPIC -std=c++17 -MD -MT plugins/obs-browser/CMakeFiles/obs-browser.dir/obs-browser-source.cpp.o -MF plugins/obs-browser/CMakeFiles/obs-browser.dir/obs-browser-source.cpp.o.d -o plugins/obs-browser/CMakeFiles/obs-browser.dir/obs-browser-source.cpp.o -c /home/ocean/Code/obs/obs-studio/plugins/obs-browser/obs-browser-source.cpp
/home/ocean/Code/obs/obs-studio/plugins/obs-browser/obs-browser-source.cpp: In lambda function:
/home/ocean/Code/obs/obs-studio/plugins/obs-browser/obs-browser-source.cpp:184:44: error: ‘CefBrowserSettings’ {aka ‘class CefStructBase<CefBrowserSettingsTraits>’} has no member named ‘web_security’
  184 |                         cefBrowserSettings.web_security = STATE_DISABLED;
      |                                            ^~~~~~~~~~~~
ninja: build stopped: subcommand failed.

Steps to Reproduce

  1. Clone the repo
  2. cd obs-plugins/obs-browser && git pull to make sure we are on master branch of the plugin
  3. Download prebuilt libcef binary from https://cef-builds.spotifycdn.com/index.html
  4. Extract cef_binary_91.1.23+g04c8d56+chromium-91.0.4472.164_linux64_minimal.tar.bz2 and build the wrapper
  5. Try to build obs-studio ...

Anything else we should know?

It seems that the upstream has a new key in cef_browser_settings_t

typedef struct _cef_broswer_settings_t {

  ///
  // Controls whether file URLs will have access to all URLs. Also configurable
  // using the "allow-universal-access-from-files" command-line switch.
  ///
  cef_state_t universal_access_from_file_urls;

https://github.com/chromiumembedded/cef/blob/1ffa5528b3e3640751e19cf47d8bcb615151907b/include/internal/cef_types.h#L609

Changing the offending line to cefBrowserSettings.universal_access_from_file = STATE_ENABLED; fixes the build. I have not got a chance to test the functionality though.

WizardCM commented 3 years ago

Hi, would you be willing to submit a PR with the relevant change? Be sure to add a CEF version check.

WizardCM commented 3 years ago

After further digging, the flag you suggested is unrelated to the functionality that web_security used to allow (and has existed since 2013).

Additionally, you can find information on why the flag was removed here.

OceanS2000 commented 3 years ago

@WizardCM Thanks for your information! So it makes sense to just remove reference to web_security entirely? I have drafted a PR and please review!

RytoEX commented 2 years ago

This should be resolved with #323. As that PR is included with the obs-browser shipped with OBS Studio 27.2, this should also be resolved in full builds of OBS Studio 27.2+.