### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Electron Version

15, 16

### What operating system are you using?

Windows

### Operating System Version

Windows 10 19042.985

### What arch are you using?

x64

### Last Known Working Electron version

14

### Expected Behavior

Cookie setting succeeds

### Actual Behavior

It is no longer possible to set an insecure cookie
```
session.cookies.set({
	name: "testcookie",
	value: "testvalue",
	domain: ".testdomain.com",
	path: "/",
	url: "http://testdomain.com",
	secure: false,
}).then(() => {
	console.log("setting cookie success");
}).catch((e) => {
	console.error(e);
});
```
returns: [Error: Setting cookie failed]
Removing the "secure: false" returns: [Error: Cannot create a secure cookie from an insecure URL]


### Testcase Gist URL

https://gist.github.com/t57ser/a34dfe9579b856e6e765b59fb8d215cb

### Additional Information

_No response_
shell/browser/api/electron_api_cookies.cc
promise.RejectWithErrorMessage(error);
    return handle;
  }
  bool secure = details.FindBoolKey("secure").value_or(
      same_site == net::CookieSameSite::NO_RESTRICTION);
  bool same_party =
      details.FindBoolKey("sameParty")
          .value_or(secure && same_site != net::CookieSameSite::STRICT_MODE);
  GURL url(url_string ? *url_string : "");
  if (!url.is_valid()) {
    promise.RejectWithErrorMessage(
        InclusionStatusToString(net::CookieInclusionStatus(
            net::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN)));
    return handle;
  }
  auto canonical_cookie = net::CanonicalCookie::CreateSanitizedCookie(
      url, name ? *name : "", value ? *value : "", domain ? *domain : "",
      path ? *path : "",
      ParseTimeProperty(details.FindDoubleKey("creationDate")),
      ParseTimeProperty(details.FindDoubleKey("expirationDate")),
      ParseTimeProperty(details.FindDoubleKey("lastAccessDate")), secure,
      http_only, same_site, net::COOKIE_PRIORITY_DEFAULT, same_party,
      absl::nullopt);
  if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
    promise.RejectWithErrorMessage(
        InclusionStatusToString(net::CookieInclusionStatus(
            net::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE)));
    return handle;
  }
  net::CookieOptions options;