Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
480 changes: 480 additions & 0 deletions LICENSES/lgpl-2.0.txt

Large diffs are not rendered by default.

501 changes: 501 additions & 0 deletions LICENSES/lgpl-2.1.txt

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# oss-source

Source for the LGPL-licensed components that Kernel's browser images modify.

Kernel's browser images ship a Chromium build. A small number of files in that
build are LGPL-licensed, and some of them carry Kernel changes:

| Path | License |
|---|---|
| `third_party/blink/renderer/core/frame/navigator.cc` | LGPL-2.0-or-later |
| `third_party/blink/renderer/core/page/page.cc` | LGPL-2.0-or-later |
| `third_party/ffmpeg/**` | LGPL-2.1-or-later |

This repository publishes those files as they appear in the shipping build, so
that recipients of the images can obtain the corresponding source of the
modified library files.

## Contents

- `lgpl/source/` — complete text of each modified file, at its path within the
Chromium tree.
- `lgpl/patches/` — the changes applied to those files.
- `pins.md` — the upstream revisions these files are based on.
- `LICENSES/` — full license texts.

## Using these files

Every path under `lgpl/source/` matches the same path in Chromium at the
revisions in `pins.md`. The files are complete, and the patches are included so
the change can be reviewed against upstream.

## Not covered here

Files in the images that are not LGPL — BSD-licensed Chromium code and
third-party components under their own licenses — are not reproduced here.
Their source is public at the pins in `pins.md`, and their licenses are
recorded in the third-party notices file shipped in the image at
`/usr/share/doc/kernel/THIRD-PARTY-NOTICES.txt`.

## Contact

legal@kernel.sh
27 changes: 27 additions & 0 deletions lgpl/patches/0005-freeze-navigator.webdriver-to-false.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Kernel Browser: Freeze navigator.webdriver to false always

This patch forces navigator.webdriver to always return false,
matching the behavior of a real non-automated browser.

Bot detection services like Cloudflare and DataDome check this
property - a value of true indicates automation and triggers blocks.

--- a/third_party/blink/renderer/core/frame/navigator.cc
+++ b/third_party/blink/renderer/core/frame/navigator.cc
@@ -98,14 +98,8 @@ bool Navigator::cookieEnabled() const {
return cookie_enabled;
}

-bool Navigator::webdriver() const {
- if (RuntimeEnabledFeatures::AutomationControlledEnabled())
- return true;
-
- bool automation_enabled = false;
- probe::ApplyAutomationOverride(GetExecutionContext(), automation_enabled);
- return automation_enabled;
-}
+// KERNEL: Always return false to match non-automated browser behavior
+bool Navigator::webdriver() const { return false; }

String Navigator::GetAcceptLanguages() {
if (!DomWindow())
287 changes: 287 additions & 0 deletions lgpl/patches/0037-build-ffmpeg-hevc-decoder.patch

Large diffs are not rendered by default.

122 changes: 122 additions & 0 deletions lgpl/source/third_party/blink/renderer/core/frame/navigator.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* Copyright (C) 2000 Harri Porten (porten@kde.org)
* Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
* Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA
*/

#include "third_party/blink/renderer/core/frame/navigator.h"

#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/execution_context/navigator_base.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/inspector/locale_controller.h"
#include "third_party/blink/renderer/core/loader/frame_loader.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/language.h"

namespace blink {

Navigator::Navigator(ExecutionContext* context) : NavigatorBase(context) {}

String Navigator::productSub() const {
return "20030107";
}

String Navigator::vendor() const {
// Do not change without good cause. History:
// https://code.google.com/p/chromium/issues/detail?id=276813
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=27786
// https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/QrgyulnqvmE
return "Google Inc.";
}

String Navigator::vendorSub() const {
return "";
}

String Navigator::platform() const {
// TODO(955620): Consider changing devtools overrides to only allow overriding
// the platform with a frozen platform to distinguish between
// mobile and desktop when ReduceUserAgent is enabled.
if (!DomWindow())
return NavigatorBase::platform();
const String& platform_override =
DomWindow()->GetFrame()->GetSettings()->GetNavigatorPlatformOverride();
return platform_override.empty() ? NavigatorBase::platform()
: platform_override;
}

bool Navigator::cookieEnabled() const {
if (!DomWindow())
return false;

if (DomWindow()->GetStorageKey().IsThirdPartyContext()) {
DomWindow()->CountUse(WebFeature::kNavigatorCookieEnabledThirdParty);
}

Settings* settings = DomWindow()->GetFrame()->GetSettings();
bool cookie_enabled = settings && settings->GetCookieEnabled();

#if !BUILDFLAG(IS_ANDROID)
// We don't want to print this message for WebView, and the utility is much
// lower for all Android platforms anyway, so it seems reasonable to skip.
if (cookie_enabled && DomWindow()->Url().IsLocalFile()) {
DomWindow()->AddConsoleMessage(
MakeGarbageCollected<ConsoleMessage>(
mojom::blink::ConsoleMessageSource::kJavaScript,
mojom::blink::ConsoleMessageLevel::kWarning,
"While navigator.cookieEnabled does return true for this file:// "
"URL, this is done for web compatability reasons. Cookies will not "
"actually be stored for file:// URLs. If you want this to change "
"please leave feedback on crbug.com/378604901."),
/*discard_duplicates=*/true);
}
#endif

return cookie_enabled;
}

// KERNEL: Always return false to match non-automated browser behavior
bool Navigator::webdriver() const { return false; }

String Navigator::GetAcceptLanguages() {
if (!DomWindow())
return DefaultLanguage();

// Kernel Browser: browser-owned languages; DevTools overrides apply above.
String kernel_languages =
LocaleController::instance().KernelAcceptLanguages();
if (!kernel_languages.empty()) {
return kernel_languages;
}
return DomWindow()->GetFrame()->GetPage()->GetSettings().GetAcceptLanguages();
}

void Navigator::Trace(Visitor* visitor) const {
NavigatorBase::Trace(visitor);
Supplementable<Navigator>::Trace(visitor);
}

} // namespace blink
Loading