Bug 170446 - Exception when trying to get self.crypto.webkitSubtle in WebWorker
Summary: Exception when trying to get self.crypto.webkitSubtle in WebWorker
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-04 04:00 PDT by Yury Strozhevsky
Modified: 2017-04-06 02:39 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yury Strozhevsky 2017-04-04 04:00:45 PDT
I am trying to use WebCrypto API inside WebWorker. When I try to even just get value of "self.crypto.webkitSubtle" I got error "Operation is not supported". When I get value of "self.crypto.subtle" everithing is fine. I do know that "webkitSubtle" is deprecated, but I do expect to have just a warning here, not an expection.
Comment 1 Alexey Proskuryakov 2017-04-04 17:11:00 PDT
self.crypto.webkitSubtle wasn't supported in workers in the past, so this is not a regression. Please use non-deprecated API.
Comment 2 Yury Strozhevsky 2017-04-04 23:15:03 PDT
Alexey, seems you misunderstand the issue. I have an exception during getting a value of existing property for "self.crypto". It is not during using the webkitSubtle, but just while getting value. 

So, even if it "wasn't supported in the past" this is a bug. No it is a BUG - you have a property of standard system object but no one could even read the property value without exception.

In fact I do not have old Safari for testing, but I had Safari working with this code inside WebWroker (it is from PKI.js library, https://github.com/PeculiarVentures/PKI.js/blob/master/src/common.js#L46):
if("webkitSubtle" in self.crypto)
{
	subtleObject = self.crypto.webkitSubtle;
	engineName = "safari";
}

So, please fix the bug - it is a real bug. And I do believe it is easy to fix.
Comment 3 Alexey Proskuryakov 2017-04-04 23:34:43 PDT
Getters are allowed to raise exceptions, and often do. This is expected behavior for crypto.webkitSubtle.
Comment 4 Jiewen Tan 2017-04-05 11:04:00 PDT
(In reply to Yury Strozhevsky from comment #0)
> I am trying to use WebCrypto API inside WebWorker. When I try to even just
> get value of "self.crypto.webkitSubtle" I got error "Operation is not
> supported". When I get value of "self.crypto.subtle" everithing is fine. I
> do know that "webkitSubtle" is deprecated, but I do expect to have just a
> warning here, not an expection.

Please use our new api self.crypto.subtle for any future development. Thanks.
Comment 5 Yury Strozhevsky 2017-04-06 02:39:15 PDT
I made a comment in this bug: https://bugs.webkit.org/show_bug.cgi?id=165913
Hope someone really solved the bug would ask there and clarify situation.