The global cookie settings have been simplified a little and Opera now supports Site-specific Preferences, which allow you to change the cookie settings on a per-site basis.
The cookie settings under "tools -> preferences -> advanced -> cookies" are referred to as the "global cookie settings" (as opposed to the ones for a site preference).
The cookie settings for a site preference are under "tools -> preferences -> advanced -> content -> manage site preferences -> the site -> edit -> cookies tab".
When you create a site preference, you create it for a certain domain. The domain can be a top-level domain (com), a second-level domain (test.com), or a third-level domain (sub.test.com) etc.
'domain' will be used below to refer to the domain the site preference is for. 'subdomains' will be used below to refer to nth-level domains that are automatically inherited under the site preference domain. 'remote domains' will refer to totally different domains that are considered cross-site.
Like Opera 8.x, you have awesome control of the rules Opera follows. You have default rules, and just like the server manager in 8.x, you can use Site preferences to add exceptions and even exceptions to those exceptions. You can do whitelisting, blacklisting, inheritance and inbetween.
If you add test.com as a site preference, as far as the cookie settings go, sub.test.com is automatically implied and if you have a sub.test.com site preference, its cookie setting doesn't do anything, so you can ignore it. You need to edit the cookie setting in the site preference for test.com instead.
Now, if you want sub1.test.com and sub2.test.com to have different cookie settings, you should not create a test.com site preference. You should create sub1.test.com and sub2.test.com site preferences and set their cookie settings to what you want.
This way, you have control over the inheritance.
An example of this:
1. Set google.com to "Accept cookies" or "Accept only cookies from the site I visit".
2. Set mail.google.com to "Never accept cookies".
In this case, the mail.google.com setting doesn't do anything because it's controlled by google.com's.
That way, you can cover all google services at once if you want.
It is important that you keep inheritance in mind when editing domains in Site preferences, so you get the desired result.
1. Set the global to "Never accept cookies".
2. To add an exception, create a site preference for the domain you want and set it to "Accept cookies" or "Accept only cookies from the site I visit".
If you set the site preference to "Accept cookies only from the site I visit", while visiting this domain, only content that resides on this domain can set cookies.
If you set the site preference to "Accept cookies", while visiting this domain, in addition to the cookies allowed by the "Accept cookies only from the site I visit" rule, content coming from a remote domain can set cookies for its corresponding domain and subdomains IF AND ONLY IF the remote domain also has a site preference that allows cookies for itself. This means that if you want to allow remote domains while visiting this domain, you need to manually add a site preference for each remote domain and set it to "Accept cookies only for the site I visit" or "Accept cookies".
"Accept cookies" for a site preference DOES NOT cause Opera to behave as if the global is set to "Accept cookies" when visiting the domain. This way you're not automatically getting opted in to remote domains. You have control over what remote domains you want to allow.
Set the global to "Accept cookies".
While visiting a domain, if you want to block remote content from setting cookies for its relative domain, add the site you're visiting to Site preferences and set its cookie setting to "Accept cookies only for the site I visit".
While visiting a domain, if you want to block all content on the domain and all content from remote domains from setting cookies, add the domain you're visiting to Site prefrences and set its cookie setting to "Never accept cookies".
Set the global to "Accept cookies only for the site I visit".
With this setting, while visiting a domain, only content coming from the domain can set cookies. However, like the other settings, this can be overridden with a Site preference.
While visiting the domain, if you want to allow remote content to set cookies for its domain, add the domain you're visiting to site preferences and set its cookie setting to "Accept cookies". Additionally, if there are certain remote domains that you want to block, you can add a site preference for each of them and set their cookie setting to "Never accept cookies" so they are not included in the exception.
While visiting the domain, if you want to block all cookies, add a site preference for the domain and set its cookie setting to "Never accept cookies".
localhost cookies are session-only.
If you have a local Apache server running for example and want to make use of persistent cookies, set it up to use 127.0.0.1
Then, access the content on the server via http://127.0.0.1/
This documentation is developed from messing with the different configs. It might not be completely accurate as of yet. Plus, wording and all that will need to mature.