idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
13,700 | qreal OxideQQuickWebView::contentY() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return 0.f;
}
return const_cast<OxideQQuickWebViewPrivate*>(
d)->proxy_->compositorFrameScrollOffset().y();
}
| null | 0 | qreal OxideQQuickWebView::contentY() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return 0.f;
}
return const_cast<OxideQQuickWebViewPrivate*>(
d)->proxy_->compositorFrameScrollOffset().y();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,701 | OxideQQuickWebContext* OxideQQuickWebView::context() const {
Q_D(const OxideQQuickWebView);
QObject* c = d->contextHandle();
if (!c) {
return nullptr;
}
return qobject_cast<OxideQQuickWebContext*>(c);
}
| null | 0 | OxideQQuickWebContext* OxideQQuickWebView::context() const {
Q_D(const OxideQQuickWebView);
QObject* c = d->contextHandle();
if (!c) {
return nullptr;
}
return qobject_cast<OxideQQuickWebContext*>(c);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,702 | void OxideQQuickWebViewPrivate::contextConstructed() {
if (constructed_) {
completeConstruction();
}
}
| null | 0 | void OxideQQuickWebViewPrivate::contextConstructed() {
if (constructed_) {
completeConstruction();
}
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,703 | void OxideQQuickWebViewPrivate::contextDestroyed() {
Q_Q(OxideQQuickWebView);
if (construct_props_) {
construct_props_->context = nullptr;
}
emit q->contextChanged();
}
| null | 0 | void OxideQQuickWebViewPrivate::contextDestroyed() {
Q_Q(OxideQQuickWebView);
if (construct_props_) {
construct_props_->context = nullptr;
}
emit q->contextChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,704 | QObject* OxideQQuickWebViewPrivate::contextHandle() const {
if (!proxy_) {
return construct_props_->context;
}
return proxy_->context();
}
| null | 0 | QObject* OxideQQuickWebViewPrivate::contextHandle() const {
if (!proxy_) {
return construct_props_->context;
}
return proxy_->context();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,705 | QString OxideQQuickWebView::currentState() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QString();
}
return QString::fromLocal8Bit(d->proxy_->currentState().toBase64());
}
| null | 0 | QString OxideQQuickWebView::currentState() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QString();
}
return QString::fromLocal8Bit(d->proxy_->currentState().toBase64());
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,706 | void OxideQQuickWebViewPrivate::detachContextSignals(
OxideQQuickWebContextPrivate* context) {
Q_Q(OxideQQuickWebView);
if (!context) {
return;
}
QObject::disconnect(context, SIGNAL(constructed()),
q, SLOT(contextConstructed()));
QObject::disconnect(context, SIGNAL(destroyed()),
q, SLOT(contextDestroyed()));
}
| null | 0 | void OxideQQuickWebViewPrivate::detachContextSignals(
OxideQQuickWebContextPrivate* context) {
Q_Q(OxideQQuickWebView);
if (!context) {
return;
}
QObject::disconnect(context, SIGNAL(constructed()),
q, SLOT(contextConstructed()));
QObject::disconnect(context, SIGNAL(destroyed()),
q, SLOT(contextDestroyed()));
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,707 | void OxideQQuickWebView::dragLeaveEvent(QDragLeaveEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::dragLeaveEvent(event);
d->contents_view_->handleDragLeaveEvent(event);
}
| null | 0 | void OxideQQuickWebView::dragLeaveEvent(QDragLeaveEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::dragLeaveEvent(event);
d->contents_view_->handleDragLeaveEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,708 | void OxideQQuickWebView::dragMoveEvent(QDragMoveEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::dragMoveEvent(event);
d->contents_view_->handleDragMoveEvent(event);
}
| null | 0 | void OxideQQuickWebView::dragMoveEvent(QDragMoveEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::dragMoveEvent(event);
d->contents_view_->handleDragMoveEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,709 | OxideQQuickWebView::editingCapabilities() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return NoCapability;
}
oxide::qt::EditCapabilityFlags flags = d->proxy_->editFlags();
return static_cast<EditCapabilities>(flags);
}
| null | 0 | OxideQQuickWebView::editingCapabilities() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return NoCapability;
}
oxide::qt::EditCapabilityFlags flags = d->proxy_->editFlags();
return static_cast<EditCapabilities>(flags);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,710 | void OxideQQuickWebView::executeEditingCommand(EditingCommands command) const {
Q_D(const OxideQQuickWebView);
Q_STATIC_ASSERT(
EditingCommandUndo ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_UNDO));
Q_STATIC_ASSERT(
EditingCommandRedo ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_REDO));
Q_STATIC_ASSERT(
EditingCommandCut ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_CUT));
Q_STATIC_ASSERT(
EditingCommandCopy ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_COPY));
Q_STATIC_ASSERT(
EditingCommandPaste ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_PASTE));
Q_STATIC_ASSERT(
EditingCommandErase ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_ERASE));
Q_STATIC_ASSERT(
EditingCommandSelectAll ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_SELECT_ALL));
if (!d->proxy_) {
return;
}
d->proxy_->executeEditingCommand(
static_cast<oxide::qt::EditingCommands>(command));
}
| null | 0 | void OxideQQuickWebView::executeEditingCommand(EditingCommands command) const {
Q_D(const OxideQQuickWebView);
Q_STATIC_ASSERT(
EditingCommandUndo ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_UNDO));
Q_STATIC_ASSERT(
EditingCommandRedo ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_REDO));
Q_STATIC_ASSERT(
EditingCommandCut ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_CUT));
Q_STATIC_ASSERT(
EditingCommandCopy ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_COPY));
Q_STATIC_ASSERT(
EditingCommandPaste ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_PASTE));
Q_STATIC_ASSERT(
EditingCommandErase ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_ERASE));
Q_STATIC_ASSERT(
EditingCommandSelectAll ==
static_cast<EditingCommands>(oxide::qt::EDITING_COMMAND_SELECT_ALL));
if (!d->proxy_) {
return;
}
d->proxy_->executeEditingCommand(
static_cast<oxide::qt::EditingCommands>(command));
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,711 | QQmlComponent* OxideQQuickWebView::filePicker() const {
Q_D(const OxideQQuickWebView);
return d->file_picker_;
}
| null | 0 | QQmlComponent* OxideQQuickWebView::filePicker() const {
Q_D(const OxideQQuickWebView);
return d->file_picker_;
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,712 | OxideQFindController* OxideQQuickWebView::findController() const {
Q_D(const OxideQQuickWebView);
return d->find_controller_.data();
}
| null | 0 | OxideQFindController* OxideQQuickWebView::findController() const {
Q_D(const OxideQQuickWebView);
return d->find_controller_.data();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,713 | void OxideQQuickWebView::focusOutEvent(QFocusEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::focusOutEvent(event);
d->contents_view_->handleFocusOutEvent(event);
}
| null | 0 | void OxideQQuickWebView::focusOutEvent(QFocusEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::focusOutEvent(event);
d->contents_view_->handleFocusOutEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,714 | void OxideQQuickWebView::geometryChanged(const QRectF& newGeometry,
const QRectF& oldGeometry) {
Q_D(OxideQQuickWebView);
QQuickItem::geometryChanged(newGeometry, oldGeometry);
d->contents_view_->handleGeometryChanged();
}
| null | 0 | void OxideQQuickWebView::geometryChanged(const QRectF& newGeometry,
const QRectF& oldGeometry) {
Q_D(OxideQQuickWebView);
QQuickItem::geometryChanged(newGeometry, oldGeometry);
d->contents_view_->handleGeometryChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,715 | OxideQQuickWebViewPrivate* OxideQQuickWebViewPrivate::get(
OxideQQuickWebView* view) {
return view->d_func();
}
| null | 0 | OxideQQuickWebViewPrivate* OxideQQuickWebViewPrivate::get(
OxideQQuickWebView* view) {
return view->d_func();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,716 | int OxideQQuickWebViewPrivate::getNavigationEntryCount() const {
if (!proxy_) {
return 0;
}
return proxy_->getNavigationEntryCount();
}
| null | 0 | int OxideQQuickWebViewPrivate::getNavigationEntryCount() const {
if (!proxy_) {
return 0;
}
return proxy_->getNavigationEntryCount();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,717 | QDateTime OxideQQuickWebViewPrivate::getNavigationEntryTimestamp(
int index) const {
return proxy_->getNavigationEntryTimestamp(index);
}
| null | 0 | QDateTime OxideQQuickWebViewPrivate::getNavigationEntryTimestamp(
int index) const {
return proxy_->getNavigationEntryTimestamp(index);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,718 | QString OxideQQuickWebViewPrivate::getNavigationEntryTitle(int index) const {
return proxy_->getNavigationEntryTitle(index);
}
| null | 0 | QString OxideQQuickWebViewPrivate::getNavigationEntryTitle(int index) const {
return proxy_->getNavigationEntryTitle(index);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,719 | int OxideQQuickWebViewPrivate::getNavigationEntryUniqueID(int index) const {
return proxy_->getNavigationEntryUniqueID(index);
}
| null | 0 | int OxideQQuickWebViewPrivate::getNavigationEntryUniqueID(int index) const {
return proxy_->getNavigationEntryUniqueID(index);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,720 | void OxideQQuickWebView::hoverEnterEvent(QHoverEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::hoverEnterEvent(event);
d->contents_view_->handleHoverEnterEvent(event);
}
| null | 0 | void OxideQQuickWebView::hoverEnterEvent(QHoverEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::hoverEnterEvent(event);
d->contents_view_->handleHoverEnterEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,721 | void OxideQQuickWebView::hoverLeaveEvent(QHoverEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::hoverLeaveEvent(event);
d->contents_view_->handleHoverLeaveEvent(event);
}
| null | 0 | void OxideQQuickWebView::hoverLeaveEvent(QHoverEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::hoverLeaveEvent(event);
d->contents_view_->handleHoverLeaveEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,722 | void OxideQQuickWebView::hoverMoveEvent(QHoverEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::hoverMoveEvent(event);
d->contents_view_->handleHoverMoveEvent(event);
}
| null | 0 | void OxideQQuickWebView::hoverMoveEvent(QHoverEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::hoverMoveEvent(event);
d->contents_view_->handleHoverMoveEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,723 | QUrl OxideQQuickWebView::hoveredUrl() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QUrl();
}
return d->proxy_->targetUrl();
}
| null | 0 | QUrl OxideQQuickWebView::hoveredUrl() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QUrl();
}
return d->proxy_->targetUrl();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,724 | QUrl OxideQQuickWebView::icon() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QUrl();
}
return d->proxy_->favIconUrl();
}
| null | 0 | QUrl OxideQQuickWebView::icon() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QUrl();
}
return d->proxy_->favIconUrl();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,725 | bool OxideQQuickWebView::incognito() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return d->construct_props_->incognito;
}
return d->proxy_->incognito();
}
| null | 0 | bool OxideQQuickWebView::incognito() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return d->construct_props_->incognito;
}
return d->proxy_->incognito();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,726 | void OxideQQuickWebView::inputMethodEvent(QInputMethodEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::inputMethodEvent(event);
d->contents_view_->handleInputMethodEvent(event);
}
| null | 0 | void OxideQQuickWebView::inputMethodEvent(QInputMethodEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::inputMethodEvent(event);
d->contents_view_->handleInputMethodEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,727 | QVariant OxideQQuickWebView::inputMethodQuery(
Qt::InputMethodQuery query) const {
Q_D(const OxideQQuickWebView);
return d->contents_view_->inputMethodQuery(query);
}
| null | 0 | QVariant OxideQQuickWebView::inputMethodQuery(
Qt::InputMethodQuery query) const {
Q_D(const OxideQQuickWebView);
return d->contents_view_->inputMethodQuery(query);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,728 | void OxideQQuickWebView::itemChange(QQuickItem::ItemChange change,
const QQuickItem::ItemChangeData& value) {
Q_D(OxideQQuickWebView);
QQuickItem::itemChange(change, value);
d->contents_view_->handleItemChange(change);
}
| null | 0 | void OxideQQuickWebView::itemChange(QQuickItem::ItemChange change,
const QQuickItem::ItemChangeData& value) {
Q_D(OxideQQuickWebView);
QQuickItem::itemChange(change, value);
d->contents_view_->handleItemChange(change);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,729 | void OxideQQuickWebViewPrivate::killWebProcess(bool crash) {
if (!proxy_) {
return;
}
proxy_->killWebProcess(crash);
}
| null | 0 | void OxideQQuickWebViewPrivate::killWebProcess(bool crash) {
if (!proxy_) {
return;
}
proxy_->killWebProcess(crash);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,730 | void OxideQQuickWebView::loadHtml(const QString& html, const QUrl& baseUrl) {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
d->construct_props_->load_html = true;
d->construct_props_->html = html;
d->construct_props_->url = baseUrl;
return;
}
d->proxy_->loadHtml(html, baseUrl);
}
| null | 0 | void OxideQQuickWebView::loadHtml(const QString& html, const QUrl& baseUrl) {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
d->construct_props_->load_html = true;
d->construct_props_->html = html;
d->construct_props_->url = baseUrl;
return;
}
d->proxy_->loadHtml(html, baseUrl);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,731 | int OxideQQuickWebView::loadProgress() const {
Q_D(const OxideQQuickWebView);
return d->load_progress_;
}
| null | 0 | int OxideQQuickWebView::loadProgress() const {
Q_D(const OxideQQuickWebView);
return d->load_progress_;
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,732 | bool OxideQQuickWebView::loading() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return false;
}
return d->proxy_->loading();
}
| null | 0 | bool OxideQQuickWebView::loading() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return false;
}
return d->proxy_->loading();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,733 | bool OxideQQuickWebViewPrivate::locationBarAnimated() const {
if (!proxy_) {
return construct_props_->location_bar_animated;
}
return proxy_->locationBarAnimated();
}
| null | 0 | bool OxideQQuickWebViewPrivate::locationBarAnimated() const {
if (!proxy_) {
return construct_props_->location_bar_animated;
}
return proxy_->locationBarAnimated();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,734 | int OxideQQuickWebViewPrivate::locationBarContentOffset() {
if (!proxy_) {
return 0;
}
return proxy_->locationBarContentOffset();
}
| null | 0 | int OxideQQuickWebViewPrivate::locationBarContentOffset() {
if (!proxy_) {
return 0;
}
return proxy_->locationBarContentOffset();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,735 | OxideQQuickLocationBarController* OxideQQuickWebView::locationBarController() {
Q_D(OxideQQuickWebView);
if (!d->location_bar_controller_) {
d->location_bar_controller_.reset(
new OxideQQuickLocationBarController(this));
}
return d->location_bar_controller_.data();
}
| null | 0 | OxideQQuickLocationBarController* OxideQQuickWebView::locationBarController() {
Q_D(OxideQQuickWebView);
if (!d->location_bar_controller_) {
d->location_bar_controller_.reset(
new OxideQQuickLocationBarController(this));
}
return d->location_bar_controller_.data();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,736 | void OxideQQuickWebViewPrivate::locationBarHide(bool animate) {
if (!proxy_) {
return;
}
proxy_->locationBarHide(animate);
}
| null | 0 | void OxideQQuickWebViewPrivate::locationBarHide(bool animate) {
if (!proxy_) {
return;
}
proxy_->locationBarHide(animate);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,737 | oxide::qt::LocationBarMode OxideQQuickWebViewPrivate::locationBarMode() const {
if (!proxy_) {
return construct_props_->location_bar_mode;
}
return proxy_->locationBarMode();
}
| null | 0 | oxide::qt::LocationBarMode OxideQQuickWebViewPrivate::locationBarMode() const {
if (!proxy_) {
return construct_props_->location_bar_mode;
}
return proxy_->locationBarMode();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,738 | int OxideQQuickWebViewPrivate::locationBarOffset() {
if (!proxy_) {
return 0;
}
return proxy_->locationBarOffset();
}
| null | 0 | int OxideQQuickWebViewPrivate::locationBarOffset() {
if (!proxy_) {
return 0;
}
return proxy_->locationBarOffset();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,739 | qreal OxideQQuickWebView::maximumZoomFactor() const {
return oxide::qt::WebViewProxy::maximumZoomFactor();
}
| null | 0 | qreal OxideQQuickWebView::maximumZoomFactor() const {
return oxide::qt::WebViewProxy::maximumZoomFactor();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,740 | void OxideQQuickWebViewPrivate::messageHandler_append(
QQmlListProperty<OxideQQuickScriptMessageHandler>* prop,
OxideQQuickScriptMessageHandler* message_handler) {
if (!message_handler) {
return;
}
OxideQQuickWebView* web_view =
static_cast<OxideQQuickWebView* >(prop->object);
web_view->addMessageHandler(message_handler);
}
| null | 0 | void OxideQQuickWebViewPrivate::messageHandler_append(
QQmlListProperty<OxideQQuickScriptMessageHandler>* prop,
OxideQQuickScriptMessageHandler* message_handler) {
if (!message_handler) {
return;
}
OxideQQuickWebView* web_view =
static_cast<OxideQQuickWebView* >(prop->object);
web_view->addMessageHandler(message_handler);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,741 | OxideQQuickScriptMessageHandler* OxideQQuickWebViewPrivate::messageHandler_at(
QQmlListProperty<OxideQQuickScriptMessageHandler>* prop,
int index) {
OxideQQuickWebViewPrivate* p = OxideQQuickWebViewPrivate::get(
static_cast<OxideQQuickWebView*>(prop->object));
if (index >= p->messageHandlers().size()) {
return nullptr;
}
return qobject_cast<OxideQQuickScriptMessageHandler*>(
p->messageHandlers().at(index));
}
| null | 0 | OxideQQuickScriptMessageHandler* OxideQQuickWebViewPrivate::messageHandler_at(
QQmlListProperty<OxideQQuickScriptMessageHandler>* prop,
int index) {
OxideQQuickWebViewPrivate* p = OxideQQuickWebViewPrivate::get(
static_cast<OxideQQuickWebView*>(prop->object));
if (index >= p->messageHandlers().size()) {
return nullptr;
}
return qobject_cast<OxideQQuickScriptMessageHandler*>(
p->messageHandlers().at(index));
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,742 | void OxideQQuickWebViewPrivate::messageHandler_clear(
QQmlListProperty<OxideQQuickScriptMessageHandler>* prop) {
OxideQQuickWebView* web_view =
static_cast<OxideQQuickWebView *>(prop->object);
OxideQQuickWebViewPrivate* p =
OxideQQuickWebViewPrivate::get(web_view);
while (p->messageHandlers().size() > 0) {
web_view->removeMessageHandler(
qobject_cast<OxideQQuickScriptMessageHandler*>(
p->messageHandlers().at(0)));
}
}
| null | 0 | void OxideQQuickWebViewPrivate::messageHandler_clear(
QQmlListProperty<OxideQQuickScriptMessageHandler>* prop) {
OxideQQuickWebView* web_view =
static_cast<OxideQQuickWebView *>(prop->object);
OxideQQuickWebViewPrivate* p =
OxideQQuickWebViewPrivate::get(web_view);
while (p->messageHandlers().size() > 0) {
web_view->removeMessageHandler(
qobject_cast<OxideQQuickScriptMessageHandler*>(
p->messageHandlers().at(0)));
}
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,743 | int OxideQQuickWebViewPrivate::messageHandler_count(
QQmlListProperty<OxideQQuickScriptMessageHandler>* prop) {
OxideQQuickWebViewPrivate* p = OxideQQuickWebViewPrivate::get(
static_cast<OxideQQuickWebView*>(prop->object));
return p->messageHandlers().size();
}
| null | 0 | int OxideQQuickWebViewPrivate::messageHandler_count(
QQmlListProperty<OxideQQuickScriptMessageHandler>* prop) {
OxideQQuickWebViewPrivate* p = OxideQQuickWebViewPrivate::get(
static_cast<OxideQQuickWebView*>(prop->object));
return p->messageHandlers().size();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,744 | QList<QObject*>& OxideQQuickWebViewPrivate::messageHandlers() {
if (!proxy_) {
return construct_props_->message_handlers;
}
return proxy_->messageHandlers();
}
| null | 0 | QList<QObject*>& OxideQQuickWebViewPrivate::messageHandlers() {
if (!proxy_) {
return construct_props_->message_handlers;
}
return proxy_->messageHandlers();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,745 | OxideQQuickWebView::messageHandlers() {
return QQmlListProperty<OxideQQuickScriptMessageHandler>(
this, nullptr,
OxideQQuickWebViewPrivate::messageHandler_append,
OxideQQuickWebViewPrivate::messageHandler_count,
OxideQQuickWebViewPrivate::messageHandler_at,
OxideQQuickWebViewPrivate::messageHandler_clear);
}
| null | 0 | OxideQQuickWebView::messageHandlers() {
return QQmlListProperty<OxideQQuickScriptMessageHandler>(
this, nullptr,
OxideQQuickWebViewPrivate::messageHandler_append,
OxideQQuickWebViewPrivate::messageHandler_count,
OxideQQuickWebViewPrivate::messageHandler_at,
OxideQQuickWebViewPrivate::messageHandler_clear);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,746 | qreal OxideQQuickWebView::minimumZoomFactor() const {
return oxide::qt::WebViewProxy::minimumZoomFactor();
}
| null | 0 | qreal OxideQQuickWebView::minimumZoomFactor() const {
return oxide::qt::WebViewProxy::minimumZoomFactor();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,747 | void OxideQQuickWebView::mousePressEvent(QMouseEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::mousePressEvent(event);
d->contents_view_->handleMousePressEvent(event);
}
| null | 0 | void OxideQQuickWebView::mousePressEvent(QMouseEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::mousePressEvent(event);
d->contents_view_->handleMousePressEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,748 | void OxideQQuickWebView::mouseReleaseEvent(QMouseEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::mouseReleaseEvent(event);
d->contents_view_->handleMouseReleaseEvent(event);
}
| null | 0 | void OxideQQuickWebView::mouseReleaseEvent(QMouseEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::mouseReleaseEvent(event);
d->contents_view_->handleMouseReleaseEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,749 | OxideQWebPreferences* OxideQQuickWebView::preferences() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
if (!d->construct_props_->preferences) {
d->construct_props_->preferences = new OxideQWebPreferences(this);
}
return d->construct_props_->preferences;
}
return d->proxy_->preferences();
}
| null | 0 | OxideQWebPreferences* OxideQQuickWebView::preferences() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
if (!d->construct_props_->preferences) {
d->construct_props_->preferences = new OxideQWebPreferences(this);
}
return d->construct_props_->preferences;
}
return d->proxy_->preferences();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,750 | void OxideQQuickWebView::prepareToClose() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
QCoreApplication::postEvent(this,
new QEvent(GetPrepareToCloseBypassEventType()));
return;
}
d->proxy_->prepareToClose();
}
| null | 0 | void OxideQQuickWebView::prepareToClose() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
QCoreApplication::postEvent(this,
new QEvent(GetPrepareToCloseBypassEventType()));
return;
}
d->proxy_->prepareToClose();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,751 | QQmlComponent* OxideQQuickWebView::promptDialog() const {
Q_D(const OxideQQuickWebView);
return d->prompt_dialog_;
}
| null | 0 | QQmlComponent* OxideQQuickWebView::promptDialog() const {
Q_D(const OxideQQuickWebView);
return d->prompt_dialog_;
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,752 | OxideQQuickWebViewAttached* OxideQQuickWebView::qmlAttachedProperties(
QObject* object) {
return new OxideQQuickWebViewAttached(object);
}
| null | 0 | OxideQQuickWebViewAttached* OxideQQuickWebView::qmlAttachedProperties(
QObject* object) {
return new OxideQQuickWebViewAttached(object);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,753 | void OxideQQuickWebView::reload() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
return;
}
d->proxy_->reload();
}
| null | 0 | void OxideQQuickWebView::reload() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
return;
}
d->proxy_->reload();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,754 | OxideQNewViewRequest* OxideQQuickWebView::request() const {
return nullptr;
}
| null | 0 | OxideQNewViewRequest* OxideQQuickWebView::request() const {
return nullptr;
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,755 | OxideQQuickWebFrame* OxideQQuickWebView::rootFrame() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return nullptr;
}
QObject* frame = d->proxy_->rootFrame();
if (!frame) {
return nullptr;
}
return qobject_cast<OxideQQuickWebFrame*>(frame);
}
| null | 0 | OxideQQuickWebFrame* OxideQQuickWebView::rootFrame() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return nullptr;
}
QObject* frame = d->proxy_->rootFrame();
if (!frame) {
return nullptr;
}
return qobject_cast<OxideQQuickWebFrame*>(frame);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,756 | OxideQSecurityStatus* OxideQQuickWebView::securityStatus() {
Q_D(OxideQQuickWebView);
return d->security_status_.data();
}
| null | 0 | OxideQSecurityStatus* OxideQQuickWebView::securityStatus() {
Q_D(OxideQQuickWebView);
return d->security_status_.data();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,757 | void OxideQQuickWebView::setAlertDialog(QQmlComponent* alertDialog) {
Q_D(OxideQQuickWebView);
if (d->alert_dialog_ == alertDialog) {
return;
}
d->alert_dialog_ = alertDialog;
emit alertDialogChanged();
}
| null | 0 | void OxideQQuickWebView::setAlertDialog(QQmlComponent* alertDialog) {
Q_D(OxideQQuickWebView);
if (d->alert_dialog_ == alertDialog) {
return;
}
d->alert_dialog_ = alertDialog;
emit alertDialogChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,758 | void OxideQQuickWebView::setConfirmDialog(QQmlComponent* confirmDialog) {
Q_D(OxideQQuickWebView);
if (d->confirm_dialog_ == confirmDialog) {
return;
}
d->confirm_dialog_ = confirmDialog;
emit confirmDialogChanged();
}
| null | 0 | void OxideQQuickWebView::setConfirmDialog(QQmlComponent* confirmDialog) {
Q_D(OxideQQuickWebView);
if (d->confirm_dialog_ == confirmDialog) {
return;
}
d->confirm_dialog_ = confirmDialog;
emit confirmDialogChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,759 | void OxideQQuickWebView::setContext(OxideQQuickWebContext* context) {
Q_D(OxideQQuickWebView);
if (d->proxy_) {
qWarning() <<
"OxideQQuickWebView: context can only be set during construction";
return;
}
if (oxideGetProcessModel() == OxideProcessModelSingleProcess) {
qWarning() <<
"OxideQQuickWebView: context is read-only in single process mode. "
"The webview will automatically use the application-wide default "
"WebContext";
return;
}
OxideQQuickWebContext* old = this->context();
if (context == old) {
return;
}
if (old) {
d->detachContextSignals(OxideQQuickWebContextPrivate::get(old));
}
if (context) {
d->attachContextSignals(OxideQQuickWebContextPrivate::get(context));
}
d->construct_props_->context = context;
emit contextChanged();
}
| null | 0 | void OxideQQuickWebView::setContext(OxideQQuickWebContext* context) {
Q_D(OxideQQuickWebView);
if (d->proxy_) {
qWarning() <<
"OxideQQuickWebView: context can only be set during construction";
return;
}
if (oxideGetProcessModel() == OxideProcessModelSingleProcess) {
qWarning() <<
"OxideQQuickWebView: context is read-only in single process mode. "
"The webview will automatically use the application-wide default "
"WebContext";
return;
}
OxideQQuickWebContext* old = this->context();
if (context == old) {
return;
}
if (old) {
d->detachContextSignals(OxideQQuickWebContextPrivate::get(old));
}
if (context) {
d->attachContextSignals(OxideQQuickWebContextPrivate::get(context));
}
d->construct_props_->context = context;
emit contextChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,760 | void OxideQQuickWebView::setContextMenu(QQmlComponent* contextMenu) {
Q_D(OxideQQuickWebView);
if (d->contents_view_->contextMenu() == contextMenu) {
return;
}
d->contents_view_->setContextMenu(contextMenu);
emit contextMenuChanged();
}
| null | 0 | void OxideQQuickWebView::setContextMenu(QQmlComponent* contextMenu) {
Q_D(OxideQQuickWebView);
if (d->contents_view_->contextMenu() == contextMenu) {
return;
}
d->contents_view_->setContextMenu(contextMenu);
emit contextMenuChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,761 | void OxideQQuickWebView::setFilePicker(QQmlComponent* filePicker) {
Q_D(OxideQQuickWebView);
if (d->file_picker_ == filePicker) {
return;
}
d->file_picker_ = filePicker;
emit filePickerChanged();
}
| null | 0 | void OxideQQuickWebView::setFilePicker(QQmlComponent* filePicker) {
Q_D(OxideQQuickWebView);
if (d->file_picker_ == filePicker) {
return;
}
d->file_picker_ = filePicker;
emit filePickerChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,762 | void OxideQQuickWebView::setFullscreen(bool fullscreen) {
Q_D(OxideQQuickWebView);
if (fullscreen == this->fullscreen()) {
return;
}
if (!d->proxy_) {
d->construct_props_->fullscreen = fullscreen;
} else {
d->proxy_->setFullscreen(fullscreen);
}
emit fullscreenChanged();
}
| null | 0 | void OxideQQuickWebView::setFullscreen(bool fullscreen) {
Q_D(OxideQQuickWebView);
if (fullscreen == this->fullscreen()) {
return;
}
if (!d->proxy_) {
d->construct_props_->fullscreen = fullscreen;
} else {
d->proxy_->setFullscreen(fullscreen);
}
emit fullscreenChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,763 | void OxideQQuickWebViewPrivate::setLocationBarAnimated(bool animated) {
if (!proxy_) {
construct_props_->location_bar_animated = animated;
} else {
proxy_->setLocationBarAnimated(animated);
}
}
| null | 0 | void OxideQQuickWebViewPrivate::setLocationBarAnimated(bool animated) {
if (!proxy_) {
construct_props_->location_bar_animated = animated;
} else {
proxy_->setLocationBarAnimated(animated);
}
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,764 | void OxideQQuickWebViewPrivate::setLocationBarMode(
oxide::qt::LocationBarMode mode) {
if (!proxy_) {
construct_props_->location_bar_mode = mode;
} else {
proxy_->setLocationBarMode(mode);
}
}
| null | 0 | void OxideQQuickWebViewPrivate::setLocationBarMode(
oxide::qt::LocationBarMode mode) {
if (!proxy_) {
construct_props_->location_bar_mode = mode;
} else {
proxy_->setLocationBarMode(mode);
}
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,765 | void OxideQQuickWebViewPrivate::setNavigationCurrentEntryIndex(int index) {
proxy_->setNavigationCurrentEntryIndex(index);
}
| null | 0 | void OxideQQuickWebViewPrivate::setNavigationCurrentEntryIndex(int index) {
proxy_->setNavigationCurrentEntryIndex(index);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,766 | void OxideQQuickWebView::setPopupMenu(QQmlComponent* popupMenu) {
Q_D(OxideQQuickWebView);
if (d->contents_view_->popupMenu() == popupMenu) {
return;
}
d->contents_view_->setPopupMenu(popupMenu);
emit popupMenuChanged();
}
| null | 0 | void OxideQQuickWebView::setPopupMenu(QQmlComponent* popupMenu) {
Q_D(OxideQQuickWebView);
if (d->contents_view_->popupMenu() == popupMenu) {
return;
}
d->contents_view_->setPopupMenu(popupMenu);
emit popupMenuChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,767 | void OxideQQuickWebView::setPreferences(OxideQWebPreferences* prefs) {
Q_D(OxideQQuickWebView);
if (prefs == this->preferences()) {
return;
}
if (!d->proxy_) {
d->construct_props_->preferences = prefs;
} else {
d->proxy_->setPreferences(prefs);
}
emit preferencesChanged();
}
| null | 0 | void OxideQQuickWebView::setPreferences(OxideQWebPreferences* prefs) {
Q_D(OxideQQuickWebView);
if (prefs == this->preferences()) {
return;
}
if (!d->proxy_) {
d->construct_props_->preferences = prefs;
} else {
d->proxy_->setPreferences(prefs);
}
emit preferencesChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,768 | void OxideQQuickWebView::setPromptDialog(QQmlComponent* promptDialog) {
Q_D(OxideQQuickWebView);
if (d->prompt_dialog_ == promptDialog) {
return;
}
d->prompt_dialog_ = promptDialog;
emit promptDialogChanged();
}
| null | 0 | void OxideQQuickWebView::setPromptDialog(QQmlComponent* promptDialog) {
Q_D(OxideQQuickWebView);
if (d->prompt_dialog_ == promptDialog) {
return;
}
d->prompt_dialog_ = promptDialog;
emit promptDialogChanged();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,769 | void OxideQQuickWebView::setRequest(OxideQNewViewRequest* request) {
Q_D(OxideQQuickWebView);
if (d->proxy_) {
qWarning() <<
"OxideQQuickWebView: request must be provided during construction";
return;
}
d->construct_props_->new_view_request = request;
}
| null | 0 | void OxideQQuickWebView::setRequest(OxideQNewViewRequest* request) {
Q_D(OxideQQuickWebView);
if (d->proxy_) {
qWarning() <<
"OxideQQuickWebView: request must be provided during construction";
return;
}
d->construct_props_->new_view_request = request;
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,770 | void OxideQQuickWebView::setRestoreState(const QString& state) {
Q_D(OxideQQuickWebView);
if (d->proxy_) {
qWarning() <<
"OxideQQuickWebView: restoreState must be provided during construction";
return;
}
d->construct_props_->restore_state =
QByteArray::fromBase64(state.toLocal8Bit());
}
| null | 0 | void OxideQQuickWebView::setRestoreState(const QString& state) {
Q_D(OxideQQuickWebView);
if (d->proxy_) {
qWarning() <<
"OxideQQuickWebView: restoreState must be provided during construction";
return;
}
d->construct_props_->restore_state =
QByteArray::fromBase64(state.toLocal8Bit());
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,771 | void OxideQQuickWebView::setUrl(const QUrl& url) {
Q_D(OxideQQuickWebView);
QUrl old_url = this->url();
if (!d->proxy_) {
d->construct_props_->load_html = false;
d->construct_props_->url = url;
d->construct_props_->html.clear();
} else {
d->proxy_->setUrl(url);
}
if (this->url() != old_url) {
emit urlChanged();
}
}
| null | 0 | void OxideQQuickWebView::setUrl(const QUrl& url) {
Q_D(OxideQQuickWebView);
QUrl old_url = this->url();
if (!d->proxy_) {
d->construct_props_->load_html = false;
d->construct_props_->url = url;
d->construct_props_->html.clear();
} else {
d->proxy_->setUrl(url);
}
if (this->url() != old_url) {
emit urlChanged();
}
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,772 | void OxideQQuickWebView::setZoomFactor(qreal factor) {
Q_D(OxideQQuickWebView);
if (qFuzzyCompare(factor, zoomFactor())) {
return;
}
if (!d->proxy_) {
qWarning() <<
"OxideQQuickWebView: zoom factor cannot be set during construction, "
"it is a per-host value";
return;
}
if (factor < minimumZoomFactor() || factor > maximumZoomFactor()) {
qWarning() <<
"OxideQQuickWebView: invalid value for zoom factor, expected to be "
"between" << minimumZoomFactor() << "and" << maximumZoomFactor();
return;
}
d->proxy_->setZoomFactor(factor);
}
| null | 0 | void OxideQQuickWebView::setZoomFactor(qreal factor) {
Q_D(OxideQQuickWebView);
if (qFuzzyCompare(factor, zoomFactor())) {
return;
}
if (!d->proxy_) {
qWarning() <<
"OxideQQuickWebView: zoom factor cannot be set during construction, "
"it is a per-host value";
return;
}
if (factor < minimumZoomFactor() || factor > maximumZoomFactor()) {
qWarning() <<
"OxideQQuickWebView: invalid value for zoom factor, expected to be "
"between" << minimumZoomFactor() << "and" << maximumZoomFactor();
return;
}
d->proxy_->setZoomFactor(factor);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,773 | void OxideQQuickWebView::stop() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
return;
}
d->proxy_->stop();
}
| null | 0 | void OxideQQuickWebView::stop() {
Q_D(OxideQQuickWebView);
if (!d->proxy_) {
return;
}
d->proxy_->stop();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,774 | QString OxideQQuickWebView::title() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QString();
}
return d->proxy_->title();
}
| null | 0 | QString OxideQQuickWebView::title() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QString();
}
return d->proxy_->title();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,775 | void OxideQQuickWebView::touchEvent(QTouchEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::touchEvent(event);
d->contents_view_->handleTouchEvent(event);
}
| null | 0 | void OxideQQuickWebView::touchEvent(QTouchEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::touchEvent(event);
d->contents_view_->handleTouchEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,776 | OxideQQuickTouchSelectionController* OxideQQuickWebView::touchSelectionController() {
Q_D(OxideQQuickWebView);
return d->contents_view_->touchSelectionController();
}
| null | 0 | OxideQQuickTouchSelectionController* OxideQQuickWebView::touchSelectionController() {
Q_D(OxideQQuickWebView);
return d->contents_view_->touchSelectionController();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,777 | void OxideQQuickWebView::touchUngrabEvent() {
Q_D(OxideQQuickWebView);
QQuickItem::touchUngrabEvent();
d->contents_view_->handleTouchUngrabEvent();
}
| null | 0 | void OxideQQuickWebView::touchUngrabEvent() {
Q_D(OxideQQuickWebView);
QQuickItem::touchUngrabEvent();
d->contents_view_->handleTouchUngrabEvent();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,778 | QUrl OxideQQuickWebView::url() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QUrl();
}
return d->proxy_->url();
}
| null | 0 | QUrl OxideQQuickWebView::url() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return QUrl();
}
return d->proxy_->url();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,779 | OxideQQuickWebView* OxideQQuickWebViewAttached::view() const {
return view_;
}
| null | 0 | OxideQQuickWebView* OxideQQuickWebViewAttached::view() const {
return view_;
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,780 | qreal OxideQQuickWebView::viewportHeight() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return 0.f;
}
return const_cast<OxideQQuickWebViewPrivate*>(
d)->proxy_->compositorFrameViewportSize().height();
}
| null | 0 | qreal OxideQQuickWebView::viewportHeight() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return 0.f;
}
return const_cast<OxideQQuickWebViewPrivate*>(
d)->proxy_->compositorFrameViewportSize().height();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,781 | qreal OxideQQuickWebView::viewportWidth() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return 0.f;
}
return const_cast<OxideQQuickWebViewPrivate*>(
d)->proxy_->compositorFrameViewportSize().width();
}
| null | 0 | qreal OxideQQuickWebView::viewportWidth() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return 0.f;
}
return const_cast<OxideQQuickWebViewPrivate*>(
d)->proxy_->compositorFrameViewportSize().width();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,782 | void OxideQQuickWebView::wheelEvent(QWheelEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::wheelEvent(event);
d->contents_view_->handleWheelEvent(event);
}
| null | 0 | void OxideQQuickWebView::wheelEvent(QWheelEvent* event) {
Q_D(OxideQQuickWebView);
QQuickItem::wheelEvent(event);
d->contents_view_->handleWheelEvent(event);
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,783 | qreal OxideQQuickWebView::zoomFactor() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return 1.0;
}
return d->proxy_->zoomFactor();
}
| null | 0 | qreal OxideQQuickWebView::zoomFactor() const {
Q_D(const OxideQQuickWebView);
if (!d->proxy_) {
return 1.0;
}
return d->proxy_->zoomFactor();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,784 | OxideQQuickWebView::~OxideQQuickWebView() {
Q_D(OxideQQuickWebView);
if (d->contextHandle()) {
d->detachContextSignals(
OxideQQuickWebContextPrivate::get(
qobject_cast<OxideQQuickWebContext*>(d->contextHandle())));
}
while (d->messageHandlers().size() > 0) {
delete d->messageHandlers().at(0);
}
d->proxy_->teardownFrameTree();
}
| null | 0 | OxideQQuickWebView::~OxideQQuickWebView() {
Q_D(OxideQQuickWebView);
if (d->contextHandle()) {
d->detachContextSignals(
OxideQQuickWebContextPrivate::get(
qobject_cast<OxideQQuickWebContext*>(d->contextHandle())));
}
while (d->messageHandlers().size() > 0) {
delete d->messageHandlers().at(0);
}
d->proxy_->teardownFrameTree();
}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,785 | OxideQQuickWebViewAttached::~OxideQQuickWebViewAttached() {}
| null | 0 | OxideQQuickWebViewAttached::~OxideQQuickWebViewAttached() {}
| @@ -2042,8 +2042,8 @@ If the application doesn't set this, then WebView will use the application
default WebContext (Oxide::defaultWebContext).
The application should ensure that the provided WebContext outlives this
-WebView. Although WebView will continue to function normally if its provided
-WebContext is deleted, it will mean that this property is null.
+WebView. Deleting the WebContext whilst the WebView is still alive may cause
+some features to stop working.
If this WebView is created as a request to open a new window (via
newViewRequested), then the WebContext will be inherited from the opening | CWE-20 | null | null |
13,786 | BrowserContextIOData::BrowserContextIOData()
: resource_context_(new ResourceContext(this)),
temporary_saved_permission_context_(
new TemporarySavedPermissionContext()) {}
| null | 0 | BrowserContextIOData::BrowserContextIOData()
: resource_context_(new ResourceContext(this)),
temporary_saved_permission_context_(
new TemporarySavedPermissionContext()) {}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,787 | BrowserContextIODataImpl(const BrowserContext::Params& params)
: data_(this, params) {}
| null | 0 | BrowserContextIODataImpl(const BrowserContext::Params& params)
: data_(this, params) {}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,788 | BrowserContextSharedIOData(BrowserContextIOData* context,
const BrowserContext::Params& params)
: path(params.path),
cache_path(params.cache_path),
max_cache_size_hint(params.max_cache_size_hint),
cookie_policy(net::StaticCookiePolicy::ALLOW_ALL_COOKIES),
session_cookie_mode(params.session_cookie_mode),
popup_blocker_enabled(true),
host_mapping_rules(params.host_mapping_rules),
user_agent_settings(new UserAgentSettingsIOData(context)),
do_not_track(false) {}
| null | 0 | BrowserContextSharedIOData(BrowserContextIOData* context,
const BrowserContext::Params& params)
: path(params.path),
cache_path(params.cache_path),
max_cache_size_hint(params.max_cache_size_hint),
cookie_policy(net::StaticCookiePolicy::ALLOW_ALL_COOKIES),
session_cookie_mode(params.session_cookie_mode),
popup_blocker_enabled(true),
host_mapping_rules(params.host_mapping_rules),
user_agent_settings(new UserAgentSettingsIOData(context)),
do_not_track(false) {}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,789 | URLRequestContext* BrowserContextIOData::CreateMainRequestContext(
content::ProtocolHandlerMap& protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!main_request_context_);
std::unique_ptr<net::CookieStore> cookie_store;
scoped_refptr<net::SQLiteChannelIDStore> channel_id_store;
if (!IsOffTheRecord() && !GetPath().empty()) {
cookie_store =
content::CreateCookieStore(
content::CookieStoreConfig(GetPath().Append(kCookiesFilename),
GetSessionCookieMode(),
nullptr, nullptr));
channel_id_store =
new net::SQLiteChannelIDStore(
GetPath().Append(kChannelIDFilename),
content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
base::SequencedWorkerPool::GetSequenceToken()));
} else {
cookie_store = content::CreateCookieStore(content::CookieStoreConfig());
}
cookie_store_owner_->set_store(std::move(cookie_store));
IOThread::Globals* io_thread_globals = IOThread::instance()->globals();
ssl_config_service_ = new SSLConfigService();
http_user_agent_settings_.reset(new HttpUserAgentSettings(this));
ftp_transaction_factory_.reset(
new net::FtpNetworkLayer(io_thread_globals->host_resolver()));
http_server_properties_.reset(new net::HttpServerPropertiesImpl());
network_delegate_.reset(new NetworkDelegate(this));
transport_security_state_.reset(new net::TransportSecurityState());
transport_security_persister_.reset(
new net::TransportSecurityPersister(
transport_security_state_.get(),
GetPath(),
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::FILE),
IsOffTheRecord()));
host_mapping_rules_.reset(new net::HostMappingRules());
const std::vector<std::string>& host_mapping_rules =
GetSharedData().host_mapping_rules;
for (std::vector<std::string>::const_iterator it =
host_mapping_rules.begin();
it != host_mapping_rules.end(); ++it) {
host_mapping_rules_->AddRuleFromString(*it);
}
main_request_context_.reset(new URLRequestContext());
URLRequestContext* context = main_request_context_.get();
net::URLRequestContextStorage* storage = context->storage();
storage->set_ssl_config_service(ssl_config_service_.get());
context->set_network_delegate(network_delegate_.get());
context->set_http_user_agent_settings(http_user_agent_settings_.get());
storage->set_channel_id_service(
base::MakeUnique<net::ChannelIDService>(
new net::DefaultChannelIDStore(channel_id_store.get()),
base::WorkerPool::GetTaskRunner(true)));
context->set_http_server_properties(http_server_properties_.get());
context->set_cookie_store(cookie_store_owner_->store());
context->set_transport_security_state(transport_security_state_.get());
content::BrowserThread::PostTask(
content::BrowserThread::FILE,
FROM_HERE,
base::Bind(&CleanupOldCacheDir, GetCachePath().Append(kCacheDirname)));
std::unique_ptr<net::HttpCache::BackendFactory> cache_backend;
if (IsOffTheRecord() || GetCachePath().empty()) {
cache_backend = net::HttpCache::DefaultBackend::InMemory(0);
} else {
cache_backend.reset(new net::HttpCache::DefaultBackend(
net::DISK_CACHE,
net::CACHE_BACKEND_SIMPLE,
GetCachePath().Append(kCacheDirname2),
GetMaxCacheSizeHint() * 1024 * 1024, // MB -> bytes
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::CACHE)));
}
net::HttpNetworkSession::Params session_params;
session_params.host_resolver = context->host_resolver();
session_params.cert_verifier = context->cert_verifier();
session_params.channel_id_service = context->channel_id_service();
session_params.transport_security_state =
context->transport_security_state();
session_params.cert_transparency_verifier =
context->cert_transparency_verifier();
session_params.ct_policy_enforcer = context->ct_policy_enforcer();
session_params.proxy_service = context->proxy_service();
session_params.ssl_config_service = context->ssl_config_service();
session_params.http_auth_handler_factory =
context->http_auth_handler_factory();
session_params.http_server_properties =
context->http_server_properties();
session_params.net_log = context->net_log();
session_params.host_mapping_rules = host_mapping_rules_.get();
http_network_session_ =
base::WrapUnique(new net::HttpNetworkSession(session_params));
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
storage->set_http_transaction_factory(
base::WrapUnique(
new net::HttpCache(http_network_session_.get(),
std::move(cache_backend),
true)));
}
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
bool set_protocol = false;
for (content::ProtocolHandlerMap::iterator it = protocol_handlers.begin();
it != protocol_handlers.end();
++it) {
set_protocol =
job_factory->SetProtocolHandler(it->first,
base::WrapUnique(it->second.release()));
DCHECK(set_protocol);
}
protocol_handlers.clear();
set_protocol = job_factory->SetProtocolHandler(
oxide::kFileScheme,
base::WrapUnique(
new net::FileProtocolHandler(
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::FILE))));
DCHECK(set_protocol);
set_protocol = job_factory->SetProtocolHandler(
oxide::kDataScheme,
base::WrapUnique(new net::DataProtocolHandler()));
DCHECK(set_protocol);
set_protocol = job_factory->SetProtocolHandler(
oxide::kFtpScheme,
base::WrapUnique(new net::FtpProtocolHandler(
ftp_transaction_factory_.get())));
DCHECK(set_protocol);
std::unique_ptr<net::URLRequestJobFactory> top_job_factory(
new URLRequestDelegatedJobFactory(std::move(job_factory),
this));
for (content::URLRequestInterceptorScopedVector::reverse_iterator it =
request_interceptors.rbegin();
it != request_interceptors.rend();
++it) {
top_job_factory.reset(
new net::URLRequestInterceptingJobFactory(std::move(top_job_factory),
base::WrapUnique(*it)));
}
request_interceptors.weak_clear();
storage->set_job_factory(std::move(top_job_factory));
resource_context_->request_context_ = context;
return main_request_context_.get();
}
| null | 0 | URLRequestContext* BrowserContextIOData::CreateMainRequestContext(
content::ProtocolHandlerMap& protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!main_request_context_);
std::unique_ptr<net::CookieStore> cookie_store;
scoped_refptr<net::SQLiteChannelIDStore> channel_id_store;
if (!IsOffTheRecord() && !GetPath().empty()) {
cookie_store =
content::CreateCookieStore(
content::CookieStoreConfig(GetPath().Append(kCookiesFilename),
GetSessionCookieMode(),
nullptr, nullptr));
channel_id_store =
new net::SQLiteChannelIDStore(
GetPath().Append(kChannelIDFilename),
content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
base::SequencedWorkerPool::GetSequenceToken()));
} else {
cookie_store = content::CreateCookieStore(content::CookieStoreConfig());
}
cookie_store_owner_->set_store(std::move(cookie_store));
IOThread::Globals* io_thread_globals = IOThread::instance()->globals();
ssl_config_service_ = new SSLConfigService();
http_user_agent_settings_.reset(new HttpUserAgentSettings(this));
ftp_transaction_factory_.reset(
new net::FtpNetworkLayer(io_thread_globals->host_resolver()));
http_server_properties_.reset(new net::HttpServerPropertiesImpl());
network_delegate_.reset(new NetworkDelegate(this));
transport_security_state_.reset(new net::TransportSecurityState());
transport_security_persister_.reset(
new net::TransportSecurityPersister(
transport_security_state_.get(),
GetPath(),
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::FILE),
IsOffTheRecord()));
host_mapping_rules_.reset(new net::HostMappingRules());
const std::vector<std::string>& host_mapping_rules =
GetSharedData().host_mapping_rules;
for (std::vector<std::string>::const_iterator it =
host_mapping_rules.begin();
it != host_mapping_rules.end(); ++it) {
host_mapping_rules_->AddRuleFromString(*it);
}
main_request_context_.reset(new URLRequestContext());
URLRequestContext* context = main_request_context_.get();
net::URLRequestContextStorage* storage = context->storage();
storage->set_ssl_config_service(ssl_config_service_.get());
context->set_network_delegate(network_delegate_.get());
context->set_http_user_agent_settings(http_user_agent_settings_.get());
storage->set_channel_id_service(
base::MakeUnique<net::ChannelIDService>(
new net::DefaultChannelIDStore(channel_id_store.get()),
base::WorkerPool::GetTaskRunner(true)));
context->set_http_server_properties(http_server_properties_.get());
context->set_cookie_store(cookie_store_owner_->store());
context->set_transport_security_state(transport_security_state_.get());
content::BrowserThread::PostTask(
content::BrowserThread::FILE,
FROM_HERE,
base::Bind(&CleanupOldCacheDir, GetCachePath().Append(kCacheDirname)));
std::unique_ptr<net::HttpCache::BackendFactory> cache_backend;
if (IsOffTheRecord() || GetCachePath().empty()) {
cache_backend = net::HttpCache::DefaultBackend::InMemory(0);
} else {
cache_backend.reset(new net::HttpCache::DefaultBackend(
net::DISK_CACHE,
net::CACHE_BACKEND_SIMPLE,
GetCachePath().Append(kCacheDirname2),
GetMaxCacheSizeHint() * 1024 * 1024, // MB -> bytes
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::CACHE)));
}
net::HttpNetworkSession::Params session_params;
session_params.host_resolver = context->host_resolver();
session_params.cert_verifier = context->cert_verifier();
session_params.channel_id_service = context->channel_id_service();
session_params.transport_security_state =
context->transport_security_state();
session_params.cert_transparency_verifier =
context->cert_transparency_verifier();
session_params.ct_policy_enforcer = context->ct_policy_enforcer();
session_params.proxy_service = context->proxy_service();
session_params.ssl_config_service = context->ssl_config_service();
session_params.http_auth_handler_factory =
context->http_auth_handler_factory();
session_params.http_server_properties =
context->http_server_properties();
session_params.net_log = context->net_log();
session_params.host_mapping_rules = host_mapping_rules_.get();
http_network_session_ =
base::WrapUnique(new net::HttpNetworkSession(session_params));
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
storage->set_http_transaction_factory(
base::WrapUnique(
new net::HttpCache(http_network_session_.get(),
std::move(cache_backend),
true)));
}
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
bool set_protocol = false;
for (content::ProtocolHandlerMap::iterator it = protocol_handlers.begin();
it != protocol_handlers.end();
++it) {
set_protocol =
job_factory->SetProtocolHandler(it->first,
base::WrapUnique(it->second.release()));
DCHECK(set_protocol);
}
protocol_handlers.clear();
set_protocol = job_factory->SetProtocolHandler(
oxide::kFileScheme,
base::WrapUnique(
new net::FileProtocolHandler(
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::FILE))));
DCHECK(set_protocol);
set_protocol = job_factory->SetProtocolHandler(
oxide::kDataScheme,
base::WrapUnique(new net::DataProtocolHandler()));
DCHECK(set_protocol);
set_protocol = job_factory->SetProtocolHandler(
oxide::kFtpScheme,
base::WrapUnique(new net::FtpProtocolHandler(
ftp_transaction_factory_.get())));
DCHECK(set_protocol);
std::unique_ptr<net::URLRequestJobFactory> top_job_factory(
new URLRequestDelegatedJobFactory(std::move(job_factory),
this));
for (content::URLRequestInterceptorScopedVector::reverse_iterator it =
request_interceptors.rbegin();
it != request_interceptors.rend();
++it) {
top_job_factory.reset(
new net::URLRequestInterceptingJobFactory(std::move(top_job_factory),
base::WrapUnique(*it)));
}
request_interceptors.weak_clear();
storage->set_job_factory(std::move(top_job_factory));
resource_context_->request_context_ = context;
return main_request_context_.get();
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,790 | void BrowserContextDelegateTraits::Destruct(const BrowserContextDelegate* x) {
if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
delete x;
return;
}
if (!content::BrowserThread::DeleteSoon(content::BrowserThread::UI,
FROM_HERE, x)) {
LOG(ERROR) <<
"BrowserContextDelegate won't be deleted. This could be due to it "
"being leaked until after Chromium shutdown has begun";
}
}
| null | 0 | void BrowserContextDelegateTraits::Destruct(const BrowserContextDelegate* x) {
if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
delete x;
return;
}
if (!content::BrowserThread::DeleteSoon(content::BrowserThread::UI,
FROM_HERE, x)) {
LOG(ERROR) <<
"BrowserContextDelegate won't be deleted. This could be due to it "
"being leaked until after Chromium shutdown has begun";
}
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,791 | BrowserContextIOData* BrowserContextIOData::FromResourceContext(
content::ResourceContext* resource_context) {
return static_cast<ResourceContext*>(resource_context)->io_data_;
}
| null | 0 | BrowserContextIOData* BrowserContextIOData::FromResourceContext(
content::ResourceContext* resource_context) {
return static_cast<ResourceContext*>(resource_context)->io_data_;
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,792 | base::FilePath BrowserContextIOData::GetCachePath() const {
const BrowserContextSharedIOData& data = GetSharedData();
if (data.cache_path.empty()) {
return GetPath();
}
return data.cache_path;
}
| null | 0 | base::FilePath BrowserContextIOData::GetCachePath() const {
const BrowserContextSharedIOData& data = GetSharedData();
if (data.cache_path.empty()) {
return GetPath();
}
return data.cache_path;
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,793 | net::StaticCookiePolicy::Type BrowserContextIOData::GetCookiePolicy() const {
const BrowserContextSharedIOData& data = GetSharedData();
base::AutoLock lock(data.lock);
return data.cookie_policy;
}
| null | 0 | net::StaticCookiePolicy::Type BrowserContextIOData::GetCookiePolicy() const {
const BrowserContextSharedIOData& data = GetSharedData();
base::AutoLock lock(data.lock);
return data.cookie_policy;
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,794 | scoped_refptr<BrowserContextDelegate> BrowserContextIOData::GetDelegate() {
BrowserContextSharedIOData& data = GetSharedData();
base::AutoLock lock(data.lock);
return data.delegate;
}
| null | 0 | scoped_refptr<BrowserContextDelegate> BrowserContextIOData::GetDelegate() {
BrowserContextSharedIOData& data = GetSharedData();
base::AutoLock lock(data.lock);
return data.delegate;
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,795 | bool BrowserContextIOData::GetDoNotTrack() const {
const BrowserContextSharedIOData& data = GetSharedData();
base::AutoLock lock(data.lock);
return data.do_not_track;
}
| null | 0 | bool BrowserContextIOData::GetDoNotTrack() const {
const BrowserContextSharedIOData& data = GetSharedData();
base::AutoLock lock(data.lock);
return data.do_not_track;
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,796 | int BrowserContextIOData::GetMaxCacheSizeHint() const {
int max_cache_size_hint = GetSharedData().max_cache_size_hint;
static int upper_limit = std::numeric_limits<int>::max() / (1024 * 1024);
DCHECK_LE(max_cache_size_hint, upper_limit);
return max_cache_size_hint;
}
| null | 0 | int BrowserContextIOData::GetMaxCacheSizeHint() const {
int max_cache_size_hint = GetSharedData().max_cache_size_hint;
static int upper_limit = std::numeric_limits<int>::max() / (1024 * 1024);
DCHECK_LE(max_cache_size_hint, upper_limit);
return max_cache_size_hint;
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,797 | BrowserContextIOData::GetTemporarySavedPermissionContext() const {
return temporary_saved_permission_context_.get();
}
| null | 0 | BrowserContextIOData::GetTemporarySavedPermissionContext() const {
return temporary_saved_permission_context_.get();
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,798 | UserAgentSettingsIOData* BrowserContextIOData::GetUserAgentSettings() const {
return GetSharedData().user_agent_settings.get();
}
| null | 0 | UserAgentSettingsIOData* BrowserContextIOData::GetUserAgentSettings() const {
return GetSharedData().user_agent_settings.get();
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
13,799 | bool BrowserContextIOData::IsPopupBlockerEnabled() const {
return GetSharedData().popup_blocker_enabled;
}
| null | 0 | bool BrowserContextIOData::IsPopupBlockerEnabled() const {
return GetSharedData().popup_blocker_enabled;
}
| @@ -558,24 +558,16 @@ class OTRBrowserContextImpl : public BrowserContext {
public:
OTRBrowserContextImpl(BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data);
-
- base::WeakPtr<OTRBrowserContextImpl> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
+ ~OTRBrowserContextImpl() override;
private:
- ~OTRBrowserContextImpl() override;
+ BrowserContext* GetOffTheRecordContext() override { return this; }
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override {
- return make_scoped_refptr(this);
- }
- BrowserContext* GetOriginalContext() const override;
+ BrowserContext* GetOriginalContext() override;
bool HasOffTheRecordContext() const override { return true; }
- scoped_refptr<BrowserContextImpl> original_context_;
-
- base::WeakPtrFactory<OTRBrowserContextImpl> weak_ptr_factory_;
+ BrowserContextImpl* original_context_;
};
class BrowserContextImpl : public BrowserContext {
@@ -583,50 +575,49 @@ class BrowserContextImpl : public BrowserContext {
BrowserContextImpl(const BrowserContext::Params& params);
private:
+ friend class BrowserContext;
+
~BrowserContextImpl() override;
- scoped_refptr<BrowserContext> GetOffTheRecordContext() override;
+ BrowserContext* GetOffTheRecordContext() override;
- BrowserContext* GetOriginalContext() const override {
- return const_cast<BrowserContextImpl*>(this);
- }
+ BrowserContext* GetOriginalContext() override { return this; }
bool HasOffTheRecordContext() const override {
return otr_context_ != nullptr;
}
- base::WeakPtr<OTRBrowserContextImpl> otr_context_;
+ std::unique_ptr<OTRBrowserContextImpl> otr_context_;
};
-OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
-
-BrowserContext* OTRBrowserContextImpl::GetOriginalContext() const {
- return original_context_.get();
+BrowserContext* OTRBrowserContextImpl::GetOriginalContext() {
+ return original_context_;
}
+OTRBrowserContextImpl::~OTRBrowserContextImpl() {}
+
OTRBrowserContextImpl::OTRBrowserContextImpl(
BrowserContextImpl* original,
BrowserContextIODataImpl* original_io_data)
: BrowserContext(new OTRBrowserContextIODataImpl(original_io_data)),
- original_context_(original),
- weak_ptr_factory_(this) {
+ original_context_(original) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServices(this);
}
-BrowserContextImpl::~BrowserContextImpl() {
- CHECK(!otr_context_);
-}
-
-scoped_refptr<BrowserContext> BrowserContextImpl::GetOffTheRecordContext() {
+BrowserContext* BrowserContextImpl::GetOffTheRecordContext() {
if (!otr_context_) {
- OTRBrowserContextImpl* context = new OTRBrowserContextImpl(
- this,
- static_cast<BrowserContextIODataImpl *>(io_data()));
- otr_context_ = context->GetWeakPtr();
+ otr_context_ =
+ base::MakeUnique<OTRBrowserContextImpl>(
+ this,
+ static_cast<BrowserContextIODataImpl*>(io_data()));
}
- return make_scoped_refptr(otr_context_.get());
+ return otr_context_.get();
+}
+
+BrowserContextImpl::~BrowserContextImpl() {
+ CHECK(!otr_context_);
}
BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
@@ -643,8 +634,9 @@ BrowserContextImpl::BrowserContextImpl(const BrowserContext::Params& params)
->CreateBrowserContextServices(this);
}
-void BrowserContextTraits::Destruct(const BrowserContext* x) {
- BrowserContextDestroyer::DestroyContext(const_cast<BrowserContext*>(x));
+void BrowserContext::Deleter::operator()(BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord());
+ BrowserContextDestroyer::DestroyContext(base::WrapUnique(context));
}
std::unique_ptr<content::ZoomLevelDelegate>
@@ -744,8 +736,8 @@ void BrowserContext::RemoveObserver(BrowserContextObserver* observer) {
observers_.RemoveObserver(observer);
}
-BrowserContext::BrowserContext(BrowserContextIOData* io_data) :
- io_data_(io_data) {
+BrowserContext::BrowserContext(BrowserContextIOData* io_data)
+ : io_data_(io_data) {
CHECK(BrowserProcessMain::GetInstance()->IsRunning()) <<
"The main browser process components must be started before " <<
"creating a context";
@@ -786,9 +778,8 @@ BrowserContext::~BrowserContext() {
}
// static
-scoped_refptr<BrowserContext> BrowserContext::Create(const Params& params) {
- scoped_refptr<BrowserContext> context = new BrowserContextImpl(params);
- return context;
+BrowserContext::UniquePtr BrowserContext::Create(const Params& params) {
+ return BrowserContext::UniquePtr(new BrowserContextImpl(params));
}
// static
@@ -800,7 +791,10 @@ void BrowserContext::ForEach(const BrowserContextCallback& callback) {
// static
void BrowserContext::AssertNoContextsExist() {
- CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0));
+ CHECK_EQ(g_all_contexts.Get().size(), static_cast<size_t>(0))
+ << "BrowserContexts still exist at shutdown! This is normally the result "
+ << "of an application leak, but it's possible that there might be an "
+ << "Oxide bug too";
}
BrowserContextID BrowserContext::GetID() const {
@@ -820,6 +814,14 @@ void BrowserContext::SetDelegate(BrowserContextDelegate* delegate) {
data.delegate = delegate;
}
+// static
+void BrowserContext::DestroyOffTheRecordContextForContext(
+ BrowserContext* context) {
+ CHECK(!context->IsOffTheRecord() && context->HasOffTheRecordContext());
+ BrowserContextDestroyer::DestroyContext(
+ std::move(static_cast<BrowserContextImpl*>(context)->otr_context_));
+}
+
bool BrowserContext::IsOffTheRecord() const {
DCHECK(CalledOnValidThread());
return io_data()->IsOffTheRecord();
@@ -829,7 +831,7 @@ bool BrowserContext::IsSameContext(BrowserContext* other) const {
DCHECK(CalledOnValidThread());
return other->GetOriginalContext() == this ||
(other->HasOffTheRecordContext() &&
- other->GetOffTheRecordContext().get() == this);
+ other->GetOffTheRecordContext() == this);
}
base::FilePath BrowserContext::GetPath() const { | CWE-20 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.